Hello, thanks for your coming. I wonder how to detect if the touched object is the a localplayer? Here is my code:
game.Players.PlayerAdded:connect(function(localplayer)
spawn = false
script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild(“humanoid”) then
-- how to add a script here to detect if it is the local player?
spawn = true
end
end)
player.CharacterAdded:connect(function(respawn)
if spawn then
print(“success!”)
end
end)
end)
If you know then please tell me, thank you!

3 comments
You already made that in the code line 5. Doesn't it work? If not maybe you should remove .Name idk.
Thank you so much! But I just got 1 more question, Y it does not work when I tried to remove the .Name function? Should not it be the same thing? Cuz I guess that the parent of the hit function is the player, they mean the same thing.
Ps: Thank you again, but for saving my life. Cuz I promised to my friend to complete his games code and if I do not complete it in this weekend my friend is going to slaughter me and I will leave this beautiful world forever. XD