I am making a story game, and I am wondering how to make this. The player has to touch the part in a certain time limit, and if they don't, the script will kill them.
✓ ANSWER ACCEPTED
How can I check if a part is not touched in a certain amount of time?
1 answer
✓ Accepted answer
local time = tick()
script.Parent.Touched:Connect(function()
local touchedTIme = tick()
if not touchedTime - time <= 30 then -- In seconds to see if the part was touched
print("Part was touched in 30 seconds.")
else
print("Part wasn't touched in time.")
end
end)
This should work.
~Dan_PanMan, advanced scripter.
1 comment
0
Thank you very much!
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
I am not sure what you want exactly but this video would be useful for you if you're talking about time https://www.youtube.com/watch?v=04HX8BJpLTE