Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to secure the RemoteEvent?

Hi! I have this kind of a problem. I have an Event, which is reseting the Player's Data, but, the any guy with decompiler could just type someone else's nickname, so he's data gonna be deleted.

Here's my code:

game.ReplicatedStorage:WaitForChild("Events").RD.OnServerEvent:Connect(function(player)
	player.leaderstats.Money.Value = 0
	player.leaderstats.Snow.Value = 0
	player.Stats.Tool.Value = "Shovel"
	player.Stats.Capacity.Value = 200
	
	player:Kick("Your data has been wiped!")
end)

If someone knows, how to secure, or if this actually does not works, and you can't wipe someone else's data (because i don't have any injector, and I don't know how this is work), please answer, i will appreciate any help! Thanks!

2 answers

Exploiter cannot change what OnServerEvent returns as it is set on the Server. Do not worry about it, you do not have to secure this one. If you want to secure events then the best option is to switch to Server management if it's possible. Make sure to never let Client to change other Clients' data as it will ruin the experience, if exploiter changes his own data, other people are not always affected by that.


game.ReplicatedStorage:WaitForChild("Events").RD.OnServerEvent:Connect(function(player,playerwanted)
if player ~= playerwanted then return end
    player.leaderstats.Money.Value = 0
    player.leaderstats.Snow.Value = 0
    player.Stats.Tool.Value = "Shovel"
    player.Stats.Capacity.Value = 200

    player:Kick("Your data has been wiped!")
end)

if you are firing the remote on their client, they need to specify the player instance for the 1st argument. if the 1st argument is nil or not their player instance, it will do nothing (you can alternatively kick them or something idk)

if you firing this on a different client or a different local entirely, you can change the

if player ~= playerwanted then return end

to

if player == playerwanted then return end

This discussion is preserved as it was. New answers, comments, and votes are closed.