I'm trying to make a tycoon owner only door with Berezaa's tycoon kit. This is what I have and I don't want it to kill :/ If anyone can help, then thanks.
function onTouched(hit)
local owner = script.Parent.Parent.Parent.Owner
local h = hit.Parent:findFirstChild("Humanoid")
if (h ~= nil) then
if h.Parent.Name == owner.Value then
script.Parent.CanCollide = false
wait(2)
script.Parent.CanCollide = true
end
end
end
script.Parent.Touched:connect(onTouched)

2 comments
Btw, it doesn't make CanCollide = false. It just stays true.
The problem doesn't look to be in this particular code. The door probably doesn't have the correct name, as in line 6 and 8, or you are trying to access the wrong item at 2 and 5.