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

is there a way to find out the last time a player fired a remote?

let's say the player's name is Donald Donald fired the Hello world remote event 5 minutes ago.

If Donald wants to fire Hello world again he needs to wait 10 minutes.

How do i find out the last time a certain player fired a certain remote?

2 answers

✓ Accepted answer

Well, as local players have their own scripts you can simply use a debounce

local Event = game:GetService('ReplicatedStorage'):WaitForChild('Hello world')
Debounce = true
local button = script.Parent --> doesn't need to be a button!
local t = 60 * 10 --> Your time to wait (I use * because I can simply change the '10' without needing to calculate every minute

button.MouseButton1Click:Connect(function()
	if Debounce then
		Debounce = false
		Event:FireServer()

		wait(t)

		Debounce = true
	end
end)

There are other ways too but I think this one is the easiest

4 comments

0

You need to set debounce = false somewhere in your script but I dont see it.

0

True, forgot that lol

0

thank you, this isn't what i was looking for but it gave me an idea on how to make the script!

0

Np xD

Calculate 10 minutes into seconds like this:

1 minute = 60 seconds

60 seconds * 10 = 600 seconds

So 10 minutes = 600 seconds

local CanFire = true -- to determine if the remote can be fired or not

function FireRemote()
	if CanFire then 
		CanFire = false -- set it to false
		Remote:FireServer()
		
		spawn(function() -- use spawn() so that the wait() does not stop the script from running
			wait(600) -- wait for 10 minutes
			CanFire = true -- set it to true so it can be fired again
		end)
	end
end

4 comments

0

I already answered that lol

0

Just took more long for me to answer because I put more explanation into it

0

So much explanation for a debounce? lol, normally I do the same but I didn't think it would be needed for a debounce

0

I explained it just in case he did not understand what it does

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