Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Stopping health regen?

I've been making a new health GUI. It works completely fine but how do I remove the script that's in the player to stop their health from regenerating as I'm going to make my own, I have found a previous question like this, But the script that was given doesn't seem to work...

game.Players.LocalPlayer.Character.Health:Destroy()

(LocalScript in StarterGUI)

Thanks :)

1 answer

✓ Accepted answer

The character is nil for a few seconds, that is why your script won't work. To solve this, you need to wait until the character is available using the CharacterAdded event's wait method.

game.Players.LocalPlayer.CharacterAdded:wait()
game.Players.LocalPlayer.Character:WaitForChild("Health"):Destroy() --In case the Health script doesn't load with the character.

2 comments

0

Wow, Something so simple stopped it from working.. Haha. Thanks man :)

0

No problem. :)

This discussion is preserved as it was. New answers, comments, and votes are closed.