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?
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?
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
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
I already answered that lol
Just took more long for me to answer because I put more explanation into it
So much explanation for a debounce? lol, normally I do the same but I didn't think it would be needed for a debounce
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.
4 comments
You need to set debounce = false somewhere in your script but I dont see it.
True, forgot that lol
thank you, this isn't what i was looking for but it gave me an idea on how to make the script!
Np xD