Ad
Log in to vote
0

LocalScript x LocalPlayer Help! :D?

Asked by 9 days ago
Edited by BlueTaslem 9 days ago

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

0
edited to add code block BlueTaslem 15905 — 9d

Hi.

Looks like you're using an ad blocker.

That's fine...

No, it really is.

Just, I mean, we put a lot of work into this site, you know?

It would be really really appreciated if you would turn off your ad blocker for our website...

We tried really hard to make our ads as unobtrusive as possible.

If you really hate ads, would you consider a $2 donation via Patreon?

Here's the link.

We love you. We hope you love us too.

.

..

...

Now back to your regularly scheduled Scripting Helpers....

...

..

.

1 answer

Log in to vote
1
Answered by 9 days ago
Edited 9 days ago

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
1
OMG THANK YOU BRO, HAVE A AWESOME AMAZING DAY! :D feferoblox 3 — 8d
0
No problem. :D BennyBoiOriginal 163 — 8d
Ad

Answer this question



Ad