You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve?
My game works as follows: player clicks a button, fires a RemoteEvent, button dissapears, server side script runs, button reappears. The entire process takes about seven seconds, which is intentional.
I want to ensure that even through bad connections, the function only runs one time when fired, even when lag makes the button vulnerable to being spam-clicked. -
What is the issue?
However, I’ve noticed that if the player has a slow connection/device, the button will not disappear in moments of lag, and a few seconds later it will spam the function without the seven second process. I hope this makes sense. -
What solutions have you tried so far? I don’t exactly know how to describe this, and the DevForum posts didn’t exactly help.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
--Obviously my code doesn't actually look like this, it's just an idea of what the function does.
local BadgeService = game:GetService("BadgeService")
local Players = game:GetService("Players")
game.Players.PlayerAdded:Connect(function(player)
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function()
--make this number value go up
--make this boolean value false
--make button invisible (through boolean)
wait(.5)
--do something
wait(.5)
--do something
wait(.5)
--do something
--if statement
--else if statment
--award badge
wait(2)
--make button visible again
end)
end)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.