Not sure why but I believe I am doing something wrong
local LP = game.Players.LocalPlayer
local C = LP.Character
local DataStore = game:GetService("DataStoreService");
local RootPart = C:WaitForChild("HumanoidRootPart")
RootPart.ChildAdded:connect(function(Object)
if Object.ClassName == "BodyGyro" or Object.ClassName == "BodyPosition" or Object.ClassName == "BodyVelocity" or Object.ClassName == "Humanoid" then
Object:Destroy()
local Data = DataStore:GetDataStore(LP.UserId.."AntiExploitban")
local isBanned = Data:GetAsync("isBanned")
local Storage = DataStore:GetDataStore(LP.."AntiExploitban");
Storage:SetAsync("isBanned", true)
if isBanned == false or isBanned == nil then
Data:SetAsync("isBanned", false)
else
if LP then
LP:kick("You have been banned indefinitely for FLYING")
end
end
end
end)```
You basically can’t. The server cannot see what the client is doing on their end, and it is up to the client to tell the server what is happening, which in turn can be mediated and intervened by the exploiter themselves.
However, the server can directly observe the player’s character to catch anything fishy. So instead of detecting child creations on the client, you can simply just monitor the physical behavior of the player on the server to see if they’re moving abnormally fast, or they’re in the air for an extended time, etc.
And this kind of anticheat is very difficult, if not impossible, for the exploiter to bypass since they cannot directly access the internals of the server.
If your planning to use a set walk speed (for example,16) you could check on the server in a while true do if their xz velocity magnitude is over 16 or 17 for some leeway so that no false detections occur.