local money = game:GetService("ServerStorage"):WaitForChild("Money")
local moneyHandler = game:GetService("ReplicatedStorage"):WaitForChild("MoneyHandler")
moneyHandler.OnServerEvent:Connect(function(player, whichScript)
money.Value += 1
print(money.Value)
end)
What kind of checks can I do so exploiters cant just execute the remote event? Or is this just how it is and it’s a sacrifice I have to make and everything related to amount of money that will be added should be handled server sided?
The danger arises in RemoteFunctions when the LocalScript sends variables to the server, in which this case is not the issue. Say you had your RemoteEvent set up like this;
Exploiters can change the amountOfMoney variable as they wish. If the amount of money is handled on the server’s side, it should not be an issue.
Although what they can do is run the RemoteEvent in a while ... do loop like so;
while true do
wait(0.25)
game.ReplicatedStorage.MoneyHandler:FireServer()
end
So they can spam the event to get money faster. A simple fix for that is to add a debounce in the server-sided script so they can’t abuse the event.
Example
local money = game:GetService("ServerStorage"):WaitForChild("Money")
local moneyHandler = game:GetService("ReplicatedStorage"):WaitForChild("MoneyHandler")
local debounce = false
moneyHandler.OnServerEvent:Connect(function(player, whichScript)
if debounce == false then
debounce = true
money.Value += 1
print(money.Value)
task.wait(<seconds to click again>)
debounce = false
end
end)