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

How can i make so that when you get a gear it gives a countdown of 3 seconds?

Asked by 2 years ago

title extension: and if u dont click in that time it kills you?

so i want to do this for a hot potato game and since the hot potato isnt instant and u gotta click i want to know because im new to scripting

0
To make a cool down make sure in your script you do wait(3) theking66hayday 841 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago

Have you ever heard of Debounce? Thats the function of cooldown

This Is example script, the player can forever touch this part and make the part be angry cuz It doesn't like being step one, however the player needs to wait 1 second before It can make the part say something

Script:

local Part = script.Parent
local Debounce = false

Part.Touched:Connect(function(hit)
    if not Debounce then
        local Humanoid = hit.Parent:WaitForChild("Humanoid")
        if Humanoid then
            Debounce = true
            print("Hey! Stop stepping on me! >:(")
            wait(1)
            Debounce = false
        end
    end
end)
Ad

Answer this question