Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

These arent the same??

Asked by 4 years ago

So I've been trying to make a reset character so I tried one script but it didnt work. I tried another one, and, it worked. But heres the thing, what I have realized is that the scripts reference the same things! Take a look:

script.Parent.MouseButton1Click:Connect(function()
    game.Players.LocalPlayer.Character.Humanoid.Health = 0
end)

This one doesn't work

script.Parent.MouseButton1Click:Connect(function()
    script.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
end)

This one works

Any reasoning?

0
game.Players.LocalPlayer only works with a local script. Geobloxia 251 — 4y
0
Is it a local script? Where is the script placed? aero9497 0 — 4y
0
LocalPlayer can only be used with LocalScripts. DesertusX 435 — 4y
0
Okay thanks alot legendcruncher82 -8 — 4y

Answer this question