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

Make a cooldown only for a certain player with remote event?

How can I make it so when you touch a part and maybe it gives you cash, only that player has to wait before they can do it again? Is there a way to do this with events? Thank you!

I tried a few times but I could seem to get it to work. I tried local player, and I also tried events.

1 answer

Well one way to do it would be to do something like this, however I am typing this on the website so I have no way to test. You do not need events.

local Delays = {}
Part:Touched(function(part)
	if part.Parent:FindFirstChild("Humanoid") then
		local char  = part.Parent
		if not Delays[char.Name] then
			-- Give Money
			pcall(function()
				Delays[char.Name] = true
				wait(60) -- can be any number of seconds
				Delays[char.Name] = nil
			end)
		end
	end
end)

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