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

LocalScript x LocalPlayer Help! :D?

Why do this script doesn't work? (srry bad english, I'm portuguese - Brazil)

localhumanoid = game.Players.LocalPlayer.Character

while true do
	localhumanoid.Humanoid.Health = 1
	localhumanoid.Humanoid.MaxHealth = 1
	wait(1)
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

1 comment

0

edited to add code block

1 answer

✓ Accepted answer

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:

local localhumanoid = script.Parent.Humanoid --Since this local script is in the character model in Workspace, we can do this.

while true do
    localhumanoid.Health = 1
    localhumanoid.MaxHealth = 1
    wait(1)
end

2 comments

1

OMG THANK YOU BRO, HAVE A AWESOME AMAZING DAY! :D

0

No problem. :D

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