I am working on a game that uses Remote Functions which there is no way to not include it. I am afraid of exploits abusing the Remote Function as I am a exploiter myself (in a good way) and I know what could happen and how. What I plan to have is a key that the script has and the server has the key too, the key is regenerated every time the client script in the gun is fired and if the key matches with the server then the function passes through. However if the remote doesn't pass then the client is disconnected from the server and their stats are cleared. I can do the last part but the actual key matching from client to the server is what I have no clue on where to start.
-- Server
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local coins = Instance.new("RemoteFunction")
coins.Parent = ReplicatedStorage
coins.Name = "coins"
local function onCreatePartRequested(player)
game.Players[player.Name].Money.Value = game.Players[player.Name].Money.Value+100
end
coins.OnServerInvoke = onCreatePartRequested

6 comments
So you want the key to be randomly generated (preferably at the same time) on both the server and the client, then if they stay the same, to allow the function to continue?
Yeah, thats my goal.
Actually thinking back, I want there to be a value with a 9 digit string randomly made on the server and the server will have it in the script thing so the client with the gun localscript will have to grab the value and put it in the remote request but since I will encrypt the localscript no exploiter will know how to aquire it
the 9-digit code would be generated when the gun is fired, when player joins or just the same for all servers?
For the player, every time it is shot a new random code is made
No I will not