Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- wait(2)
- local plr = game.Players.LocalPlayer
- local char = plr.Character
- local humanoid = char:FindFirstChild("Humanoid")
- local image = script.Parent.Image
- local health = humanoid.Health
- local function onHealthChanged()
- if health == 0 then
- script.Parent.Image = "http://www.roblox.com/asset/?id=3326061588"
- elseif health > 0 and health < 33 then
- script.Parent.Image = "http://www.roblox.com/asset/?id=3326061097"
- elseif health > 33 and health < 66 then
- script.Parent.Image = "http://www.roblox.com/asset/?id=3326059493"
- elseif health > 66 then
- script.Parent.Image = "http://www.roblox.com/asset/?id=3326058976"
- end
- end
- local function onCharacterAdded(character)
- local human = character:WaitForChild("Humanoid")
- -- Pattern: update once now, then any time the health changes
- human.HealthChanged:Connect(onHealthChanged)
- onHealthChanged()
- end
- plr.CharacterAdded:Connect(onCharacterAdded)
- if plr.Character then
- onCharacterAdded(plr.Character)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement