Skip to content

Instantly share code, notes, and snippets.

@Validark
Last active November 7, 2016 00:35
Show Gist options
  • Save Validark/e91702ea8cd51c3287bd96beb3c62468 to your computer and use it in GitHub Desktop.
Save Validark/e91702ea8cd51c3287bd96beb3c62468 to your computer and use it in GitHub Desktop.
local Loader = Instance.new("ImageLabel")
Loader.Image = "rbxassetid://538506094"
Loader.Position = UDim2.new(0.5, -200, 0.3, 0)
Loader.ScaleType = Enum.ScaleType.Slice
Loader.Size = UDim2.new(0, 400, 0, 20)
Loader.SliceCenter = Rect.new(7, 7, 14, 14)
Loader.BackgroundTransparency = 1
Loader.ZIndex = 3
local StripeHolder = Instance.new("Frame", Loader)
StripeHolder.ClipsDescendants = true
StripeHolder.Size = UDim2.new(0, 0, 0, 20)
StripeHolder.BackgroundTransparency = 1
StripeHolder.ZIndex = 6
local Stripes = Instance.new("ImageLabel", StripeHolder)
Stripes.Image = "rbxassetid://538546060"
Stripes.ImageRectOffset = Vector2.new(0, 0)
Stripes.ImageRectSize = Vector2.new(400, 20)
Stripes.Size = UDim2.new(0, 400, 0, 20)
Stripes.BackgroundTransparency = 1
Stripes.ZIndex = 7
local StripesRound = Instance.new("ImageLabel", Stripes)
StripesRound.Image = "rbxassetid://500595007"
StripesRound.ScaleType = Enum.ScaleType.Slice
StripesRound.SliceCenter = Rect.new(7, 7, 14, 14)
StripesRound.Size = UDim2.new(1, 0, 1, 0)
StripesRound.BackgroundTransparency = 1
StripesRound.ZIndex = 8
local Box = Instance.new("ImageLabel", Loader)
Box.BackgroundColor3 = Color3.fromRGB(69, 69, 69)
Box.BorderSizePixel = 0
--Box.Image = "rbxassetid://500595007"
Box.ScaleType = Enum.ScaleType.Slice
Box.SliceCenter = Rect.new(7, 7, 14, 14)
Box.Position = UDim2.new(0, 371, 0, -32)
Box.Size = UDim2.new(0, 72, 0, 26)
Box.ZIndex = 2
local BoxPointer = Instance.new("ImageLabel", Box)
BoxPointer.Image = "rbxassetid://538372081"
BoxPointer.Position = UDim2.new(0.5, -4, 1, -1)
BoxPointer.Size = UDim2.new(0, 9, 0, 6)
BoxPointer.BackgroundTransparency = 1
BoxPointer.ZIndex = 3
local BoxText = Instance.new("TextLabel", Box)
BoxText.Font = Enum.Font.ArialBold
BoxText.FontSize = Enum.FontSize.Size18
BoxText.Position = UDim2.new(.5, 0, .5, 0)
BoxText.Text = "57%"
BoxText.TextColor3 = Color3.new(1, 1, 1)
BoxText.BackgroundTransparency = 1
BoxText.ZIndex = 7
local Screen = game.StarterGui:FindFirstChild("ScreenGui") or Instance.new("ScreenGui", game.StarterGui)
Loader.Parent = Screen
local Frame = Screen:FindFirstChild("Frame") or Instance.new("Frame", Screen)
Frame.Size = UDim2.new(1, 0, 1, 0)
Frame.BackgroundColor3 = Color3.new(1, 1, 1)
local RunService = game:GetService("RunService")
local ElapsedTime = 0
local format = string.format
local StripesAnimator = RunService.Heartbeat:Connect(function(step) -- Animate Stripes
ElapsedTime = ElapsedTime + step
if ElapsedTime > 1 then
ElapsedTime = 0
end
Stripes.ImageRectOffset = Vector2.new(ElapsedTime * 48, 0)
local Percent = StripeHolder.Size.X.Scale
Box.Position = UDim2.new(Percent, -37, 0, -33)
BoxText.Text = format("%.1f%%", Percent * 100)
end)
local function UpdatePercentage(Decimal)
StripeHolder:TweenSize(UDim2.new(Decimal, 0, 0, 20), "Out", "Linear", .1, true)
if Decimal == 1 then
end
end
for a = 1, 20 do
wait(.5 + math.random(0, .5))
UpdatePercentage(a / 20)
end
wait(10)
StripesAnimator:Disconnect()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment