So i am working on this game called survive freddy and i noticed that there is a problem when freddy walks into the office he cant leave and he stays there killing everyone and they have to rejoin a new server to fix it. So i was wandering how do i put a script in the door enteryway where when he touches the part that is in the enteryway it kills him after 10 seconds but it does not kill the players playing the game. Please answer. Thanks!
✓ ANSWER ACCEPTED
How do i make it so that when a npc touches an object it kills them after 10 seconds?
1 answer
✓ Accepted answer
This should work:
script.Parent.Touched:Connect(function(hit)
if hit.Parent.Name == "[Your NPC Name]" then
wait(10)
hit.Parent:Destroy()
end
end)
But I don't recommend doing it this way. This is just an example. A better way would be to put like a Boolean Value in the NPC and make the touched function find the Boolean value.
1 comment
0
ok thank you!
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
touched event + wait(10) may do the work
does it only work for npcs? Because i do not want it to work for players.