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.
01 | local time = tick() |
02 |
03 | script.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 |
11 | end ) |
This should work.
~Dan_PanMan, advanced scripter.