Why do this script doesn't work? (srry bad english, I'm portuguese - Brazil)
1 | localhumanoid = game.Players.LocalPlayer.Character |
2 |
3 | while true do |
4 | localhumanoid.Humanoid.Health = 1 |
5 | localhumanoid.Humanoid.MaxHealth = 1 |
6 | wait( 1 ) |
7 | end |
I want to make that the Local Player have 1 HP... Please help! D: (oh, I know PlayerAdded, (ONLY THE NAME, But I dont know how to use it.) https://imgur.com/a/yipaU
A local script won't run in Players
according to this.
Consider putting the script in StarterPlayer
> StarterCharacterScripts
that way the local script will be injected into the character when the game starts.
New Script:
1 | local localhumanoid = script.Parent.Humanoid --Since this local script is in the character model in Workspace, we can do this. |
2 |
3 | while true do |
4 | localhumanoid.Health = 1 |
5 | localhumanoid.MaxHealth = 1 |
6 | wait( 1 ) |
7 | end |