Hey, Still pretty new to scripting and slowly getting my head around remotes. Before i go any further i would like some advice as to if i'm working in the right direction of Exploit prevention.
If i were to fire a RemoteEvent from a localscript, would the below ServerScript prevent exploiters from firing the event multiple times?
Note i have a seperate ServerScript creating the RemoteDebounce Bool inside ServerStorage.Player upon PlayerAdded.
local ss = game:GetService("ServerStorage")
local rs = game:GetService("ReplicatedStorage")
rs.Remote.OnServerEvent:Connect(function(player)
if ss[player.Name].RemoteDebounce.Value == true then
return
end
if ss[player.Name].RemoteDebounce.Value == false then
ss[player.Name].RemoteDebounce.Value = true
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, gamepassid) then
--Code Here--
else
--Code Here--
end
ss[player.Name].RemoteDebounce.Value = false
wait(5) --Time before can fire again--
end
end)

2 comments
Ive had my fair share of worries about this, the best you can do is give the server more control in places you understand. for example, i would probably have a value inside the character that counts down from a server script, and have the remoteevent read that value before it decides to fire.
I figured this was the roughly the same thing, except instead of a value in the player as you suggest, mine is inside serverstorage, which i believe is only accessable by the server.