How to animate a gui like mad city

Hey so I am trying to make a progress bar like madcity when you interact with something (e.g. picking up money with E key)

All I know is how to hold down the E and not how to animate per press.

Script so far:

local uis = game:GetService("UserInputService")
local runService = game:GetService("RunService")

local frameGui = script.Parent.KeyblindE.Frame

local pressed = false

uis.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.E then
pressed = true
end
end

uis.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.E then
pressed = false
end
end

runService.Stepped:Connect (function()
if pressed then
-- make gui scale
else
-- on release, set back to 0
end
end

For animating GUIs you should use TweenService.

Wait tweenservice works for guis?

2 Likes

Yes. Here is some articles:

1 Like

Yep it does! There is also an built in function for tweeting UIs too!

1 Like

Oh I dont know if you know this but am I using run service right?

I have been trying to figure it out for a while.

If you use it as a function then yes.

Like connected to a function? char

local RunService = game:GetService("RunService")

function Idkanynames()
print("I really don’t know")
end

RunService.Stepped:Connect(Idkanynames)
1 Like

Consider using Proximity Prompts, they have this built in.

1 Like