Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How can I check if a part is not touched in a certain amount of time?

Asked by 4 years ago

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.

0
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 rabbi99 714 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago
01local time = tick()
02 
03script.Parent.Touched:Connect(function()
04    local touchedTIme = tick()
05        if not touchedTime - time <= 30 then -- In seconds to see if the part was touched
06            print("Part was touched in 30 seconds.")
07        else
08            print("Part wasn't touched in time.")
09        end
10 
11end)

This should work.

~Dan_PanMan, advanced scripter.

0
Thank you very much! FireSam5163 22 — 4y
Ad

Answer this question