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 3 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 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago
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.

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

Answer this question