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

Nothing is in the output and I'm Trying to make a help bar. Whats wrong with it?

Asked by 6 years ago
game.Players.LocalPlayer.Character.Humanoid.Health.Changed:connect(function()
    local health = game.Players.LocalPlayer.Character.Humanoid.Health
    local healthbar = game.StarterGui.HealthandKiGUI.BackOfHealth.Healthbar
    if health < 100 then
        healthbar.Size = UDim2.new(1, 0, 1, 0) - UDim2.new(0, 0, health/0.01, 0)
    end
end)

What is wrong with it?

0
To display anything to the output for debugging you need to use print(Tuple<Variant> params) like print("any text and data if you concatenate it to the string") Impacthills 223 — 6y
0
`health/maxhealth`? TheeDeathCaster 2368 — 6y

1 answer

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

You are editing the StarterGui, which is the original gui that is cloned into player's PlayerGuis, not the gui being displayed to the player. So, you actually want healthbar to be game.Players.LocalPlayer.PlayerGui.HealthandKiGUI.BackOfHealth.Healthbar

Ad

Answer this question