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

Need clarification on handling exploits from client?

So essentially the client side is really only used for getting user input? And the server handles the backend stuff? So when hackers try to steal your code, they're only able to access client side code?

And if the player fires the server, we can't trust anything sent from the client? Are there ways to confirm player data (for example: the amount of money a player has) and confirm if a player is exploiting or not?

1 answer

✓ Accepted answer

Yeah so exploiters will be able to see all the code on the client and will be able to sniff out any requests you do to the server. You should not trust anything from the client, exploiters can put in their own data. To prevent these things you use server sided checks which basically happen on the server when you receive the request. I will give you an example of how I would make a team change that requires you to have 100 money.

Client:

local event = workspace.Event
local player = game:GetService("Players").LocalPlayer

if player.leaderstats.Money.Value == 100 then
	event:FireServer() -- Exploiters will be able to fire this remote by itself so we can't be sure our client side check (the if statement) will work
end

Server:

local event = workspace.Event

event.OnServerEvent:Connect(function(player)
	if player.leaderstats.Money.Value == 100 then -- This stops an exploiter dead in their tracks, there is no way for them to combat this because their money HAS to equal 100 on the server.
		player.Team = game:GetService("Teams").BlueTeam
	end
end)

So I will first check on the client side just to verify if they have enough money on their client so we don't have to strain server resources if they don't have it. You would also want to do this if maybe you wanted to add visuals that only showed up when they did have enough.

Now on the server I use my server side check to verify the player's request through the information stored on the server that can not be changed by the client. The whole "FE thing" starts to make a lot more sense now since the client can not replicate their illegal money change over to the server effectively stopping them in their tracks.

A lot of poorly designed scripts won't use this system and wont check on the server so an exploiter can simply fire the event and get what they want.

TL:DR: Never trust the client, always perform server side checks. An exploiter can see everything that exists and happens on the client.

2 comments

0

Forgot to include in my answer, there are tons of basic server side checks that you can add to your RemoteEvents to combat this stuff. For example, If the player is firing a remoteevent to buy a gun from a certain gun shop make sure they are actually near that gun shop or you obviously know that they are sending it from the other side of the map.

0

Wow, thank you for the detailed post!

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