Ok guys, so you know how most people, maybe even you, say that its impossible for the server to see what’s going on on the client, and without some weird Vector/Position checking nonsense, it’s impossible to make a working anti-exploit, but I have came up with a solution.
The good ol’ phrase, “Never Trust The Client” right?
So I found a way to make the client send the server the players humanoid details, i.e. WalkSpeed, JumpPower, Health to the server for it to check. Basically by sending a request from the server to the client via a RemoteEvent, then waiting for the client to send back the data, (I use remote events cause remote functions are just, idk, hard for me to understand), but here’s the twist, the client can’t just delete the script that does that, because the server counts up to a certain amount of time (Normally about a second) and if the server hasn’t heard a response from the client, say bye bye to our nice hacker. Now yes, someone could alter the script so that the client only sends back correct data but it would be very hard and you would hit some roadblocks, such as not knowing what the past WalkSpeed was.
Now this is great and all, but I have sort of an embarrassing problem. My code doesn’t work LOL, but in theory it should, I think I just need a second set of eyes to look at it.
Current Code (Server Side)
-- Variables --
local RequiredWalkSpeed = 16
local RequiredJumpPower = 50
local RequiredHealth = 100
-- More Variables --
local Replicated = game:GetService("ReplicatedStorage")
wait(7) -- Wait for the client to fully load
warn("Server Side Initialized") -- Let us know that it's ready to start checking clients
local function timeCheck(start, v) -- This counts the amount of time since the request was sent
if start then
local toggle = true
currentMSec = 0
while toggle do
wait(0.001)
currentMSec = currentMSec + 1
end
else
local toggle = false
if currentMSec > 2000 then -- More than 2 seconds
v:Kick("Anti-Exploit: Exploit Detected, Server Request Return never was returned. This could also be caused by a bad connection, if you were not exploiting, please check your internet connection and try again.") -- Ahahah dont delete my scripts 'tard
end
end
end
Replicated.AntiExEventClientServer.OnServerEvent:Connect(function(plr, plrstats) -- Catches the reply from the client and checks humanoid stats
local v = nil -- Prevents errors, look at client script for more details
timeCheck(false, v) -- Stop the clock
local WalkSpeed = plrstats[1]
local JumpPower = plrstats[2]
local Health = plrstats[3]
if WalkSpeed ~= RequiredWalkSpeed or JumpPower ~= RequiredJumpPower or Health ~= RequiredHealth then
plr:Kick("Anti-Exploit: Exploit Detected, One or more humanoid characteristics are incorrect.") -- haha get caught suckas
end
end)
-- Main Loop
while true do -- This loop is giving me a crap ton of headaches :(
wait(0.5) -- No crashing the server pls
for _, v in pairs(game.Players:GetChildren()) do -- Loop though the players
timeCheck(true, v) -- Start the clock
Replicated.AntiExEventServerClient:FireClient(v) -- Politely ask the client for it's humanoid information
print("Client Fired,",v.Name,"was fired successfully, awaiting Player Stats Response...")
end
end
Current Code (Client Side)
warn("Local Side Initialized")
local ClientServer = game:GetService("ReplicatedStorage"):WaitForChild("AntiExEventClientServer")
local ServerClient = game:GetService("ReplicatedStorage"):WaitForChild("AntiExEventServerClient")
ServerClient.OnClientEvent:Connect(function()
local Humanoid = game.Players.LocalPlayer.Character.Humanoid
local tablePackaged = {Humanoid.WalkSpeed, Humanoid.JumpPower, Humanoid.Health}
ClientServer:FireServer(tablePackaged)
end)
Help me please!