Use RemoteEvents. If you use it to send the value of a suspected item, it’ll send it the way the client sees it, then you can verify it on the server. Like this:
-- local script
local verifyEvent = game.ReplicatedStorage.VerifyEvent
local susValue = game.Workspace.SusValue
verifyEvent:FireServer(susValue.Value)
-- server script
local verifyEvent = game.ReplicatedStorage.VerifyEvent
local susValue = game.Workspace.SusValue
verifyEvent.OnServerEvent:Connect(function(plr, value)
if susValue.Value ~= value then
print(plr.Name, " is a fraud!")
end
end)
If you want to only verify when a value changes, change the local script to this:
-- local script
local verifyEvent = game.ReplicatedStorage.VerifyEvent
local susValue = game.Workspace.SusValue
susValue.Changed:Connect(function()
verifyEvent:FireServer(susValue.Value)
end)
(.Changed event only works on Values.)
The problem with this method is that the player could easily remove the event, therefore the script rendered useless on the client. Maybe someone else smarter than me can help you fix that.
you could try to make fake remote events with Names that sound teasing for example giveCash and then whenever they get triggered you automatically kick or ban the player.
local remote = game.ReplicatedStorage.giveCash -- change remote to your remote
remote.OnServerEvent:Connect(function(player)
player:Kick("Suspected cheating")
end)
Just put this script in serverscriptservice or something else and change Remote to your fake remote
or you could have a normal remote but with a table that contains suspicious values and whenever that remote gets triggered you check the value and if its suspicious you kick the player
local remote = game.ReplicatedStorage.giveCash -- change remote to your remote
local suspicious_values = {"Suspicious value", 1276378213678, "lol", true} -- suspicious/blacklisted values
remote.OnServerEvent:Connect(function(player, value)
if table.find(suspicious_values,value) then
player:Kick("Suspected cheating")
else
-- code here if the value isn't suspicious
end
end)
But if you are going for more advanced anti cheats that don’t involve securing remote events then you
should follow a tutorial Or do research of your own
Using remotes won’t work for real hackers, only for script kiddies using universal exploits.
If someone actually tried making an exploit for your game, they can easily send decoy data to that remote event, and the server won’t be able to distinguish it from real data.
The only way to actually prevent some exploits is on the server.
Could you tell us which exploits you would like to prevent?
Have a look on the DevForum for open-sourced server-sided anti-cheats.
This is very important, with specific targeted exploit you might be able to find other methods. Whether if it’s a restricted fly zone, a damage limiter etc