Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make a script work per 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.

2 comments

0

You could use a dictionary, and set a player's value in the table to the current time. Ex, TimeStamps[PlayerName] = CurrentTime

0

Side note, please don't repost questions unless necessary; it hadn't even been 30 minutes since your last one. Be patient

1 answer

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.