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?

4 comments

0

game.Players.LocalPlayer only works with a local script.

0

Is it a local script? Where is the script placed?

0

LocalPlayer can only be used with LocalScripts.

0

Okay thanks alot