Hi, I am making a Tycoon and I am trying to script a door that when a player walks through the door, he dies but when the owner of the tycoon walks through it, he's fine. I have tried to script it but it won't work and when I touch to own the tycoon and by the Owner Only Door then walk through it, it kills me. Here is my script:
function onTouche()
print(game.Players.LocalPlayer.Name) --Just checking if this line worked
if game.Players.LocalPlayer.Name == script.Parent.Parent.Parent.Parent.Parent.Owner.Value then
script.Parent.CanCollide = false
else game.Players.LocalPlayer.Character.Humanoid.Health = 0
end
end
script.Parent.Touched:connect(onTouche)

5 comments
you spelt on touch wrong
That;s not the problem, the ontouched function works fine, and that is just the name of the function.
The problem is it kills ME when I touch it (owner of tycoon, I don't want it to kill owner of tycoon, I dunno what did wrong)
Yup. Anyway, I posted an answer. Hope it works, because I didn't checked in Studio xD
Both codes do not work, they still kill the owner of tycoon. Also, when I printed out "game.Players.LocalPlayer.Name" it did work and printed out my name, I don't know what is wrong with the script.