Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make a health GUI that fills up?

Asked by 5 years ago

Hello, so I'm trying to understand how GUI's work, but it's giving me somewhat of a headache. I'm trying to make a script that fetches player health & fills for example a stamina icon. How would I go about this? Do I have to make 100 seperate decals?

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

No you do not have a simple script ready for i have made a few months ago!

01wait()
02 
03local Player = game:GetService'Players'.LocalPlayer
04local Character = Player.Character or Player.CharacterAdded:wait()
05local Human = Character:WaitForChild("Humanoid")
06 
07local HealthFrame = script.Parent
08 
09Human.HealthChanged:connect(function(Health)
10    HealthFrame.Size = UDim2.new(Health/Human.MaxHealth,0,1,0)
11end)

make a frame in your GUI and call it Background make the color red and then make a Frame called Positive Then inside it put a local script with the script above also can you show your attempted script maybe more people will help you with it to understand what you are attempting

Ad

Answer this question