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

How do I get the HealthGui to work? [SOLVED]

Asked by 6 years ago
Edited 6 years ago

I have no clue what to change inside the "-- Math" area because it only goes to the left and whenever I regenerate It gets lower. (Inside LocalScript)

01-- Variables
02local plr = game.Players.LocalPlayer
03local char = plr.Character or plr.CharacterAdded:Wait()
04local frame = script.Parent
05local hp = frame.HP
06local xp = frame.XP
07local nextLvl = frame.NextLvl
08local hpDisplay = frame.HPDisplay
09local stamina = frame.Stamina
10local xpDisplay = frame.XPDisplay
11 
12-- PropertyChange
13local curHp = char.Humanoid.Health
14local curMaxHp = char.Humanoid.MaxHealth
15hp.Text = 'Hp: '..tostring(curHp)..'/'..tostring(curMaxHp)
View all 33 lines...

1 answer

Log in to vote
0
Answered by 6 years ago

I figured out that I just had to check the sizes once not every time the health changes

I just put --sizes outside of HealthChanged event

01-- Variables
02local plr = game.Players.LocalPlayer
03local char = plr.Character or plr.CharacterAdded:Wait()
04local frame = script.Parent
05local hp = frame.HP
06local xp = frame.XP
07local nextLvl = frame.NextLvl
08local hpDisplay = frame.HPDisplay
09local stamina = frame.Stamina
10local xpDisplay = frame.XPDisplay
11local hum = char:WaitForChild('Humanoid')
12 
13-- PropertyChange
14local curHp = hum.Health
15local curMaxHp = hum.MaxHealth
View all 35 lines...
Ad

Answer this question