I’m trying to simply write some code to give players money. The problem I have with this is that it would be incredibly easy for exploiters to just fire the remote event and give themselves loads of money. Is there a solution that would make the code more secure, so exploiters couldn’t get into it?
Put a serverscript in the button with a localscript and a temporary remoteevent in the serverscript, then localscript will fire the remoteevent to send the name and serverscript will store the name, then delete remoteevent and localscript, therefore you can do
local player = game.Players:FindFirstChild(playername)
I don’t think you get my point, connect the mouse button event in serverscript, and the client will just send the players name.
--//SERVER
local playerToSendTo
script.Parent.MouseButton1Click:Connect(function()
-- give coins
playerToSendTo.leaderstats.Cash.Value = playerToSendTo.leaderstats.Cash.Value + 500
end)
script.NameEvent.OnServerEvent:Connect(function(plr)
playerToSendTo = plr
end)
--//Client
script.Parent.NameEvent:FireServer()
-- now get the hell out of here exploiters
I don’t know if this helps, but I would recommend having a remote even called “GiveMoney”, rather I would have them as random as I can like “GhBDsdVVdhsodd” as it would be much harder to know what each event are called there for enabling them to harder acess the things the events do. It may or may not work, as I don’t really experiment with exploits.
I feel like obfuscating your remotes would be worked around by them just printing out the names of all children in replicatedstorage, no? Just a lil trial and error then?