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

How do I make a script work per 120 seconds per person? [closed]

Asked by 5 years ago

This question already has an answer here:

how do I make a script work for 120 seconds per person?

I want to give 5 coins every time someone touches a block. But I don't want them to rapidly touch it and get a lot of money. so I want to put a 120 seconds time before they can get their money again. But I don't know how to do this.

0
You could use a dictionary, and set a player's value in the table to the current time. Ex, `TimeStamps[PlayerName] = CurrentTime` TheeDeathCaster 2368 — 5y
0
Side note, please don't repost questions unless **necessary**; it hadn't even been 30 minutes since your last one. Be patient TheeDeathCaster 2368 — 5y

Marked as Duplicate by TheeDeathCaster

This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.

Why was this question closed?

1 answer

Log in to vote
-1
Answered by
rower86 35
5 years ago
Edited 5 years ago

What you can use is debounce, you can learn about debounce here

But heres an example if you need it:

local debounce = false
local function givemoney()
    -- whatever the money giving code is
end

game.Workspace.MoneyBlock:Connect(function() -- assume that game.Workspace.MoneyBlock is the block you were describing
if debounce == true then return end
debounce = true
givemoney()
wait(120)
debounce = false
end)
Ad