I’ve been thinking of the best measures to take when defending my games. This includes account age measures, anti-no clip/speed hacking measures etc.
At the moment, I’m working on the speed hacking measure (using a tutorial), but it’s not working. Help?
local MaxSpeed = game.StarterPlayer.CharacterWalkSpeed + 5
local secondsPerCheck = 1
local monitoringTable = {}
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
table.insert(monitoringTable, #monitoringTable +1, Character)
while wait(secondsPerCheck) do
for _, v in pairs(game.Players:GetPlayers()) do
local char = v.Character or v.CharacterAdded:Wait()
local root = char:WaitForChild("HumanoidRootPart")
local lastCFrame = root.CFrame
if math.floor((Vector3.new(lastCFrame.p.X, 0, lastCFrame.p.Z) - Vector3.new(root.Position.X, 0, root.Position.Z)).magnitude) > MaxSpeed then
print(v.Name.." Is Caught with a suspicious speed")
v:Kick("Suspicious Speed")
end
end
end
end)
end)
game.Players.PlayerRemoving:Connect(function(Player)
for indexChar, Char in pairs(monitoringTable) do
if Player.Character == Char then
table.remove(monitoringTable, indexChar)
end
end
end)
local MaxSpeed = 5
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
Character.Humanoid:GetPropertyChangedSignal("WalkSpeed"):Connect(function()
local WalkSpeed = Character.Humanoid.WalkSpeed
if WalkSpeed > MaxSpeed then
print(Player.Name.." Is Caught with a suspicious speed")
Player:Kick("Suspicious Speed")
end
end)
end)
end)
u need to change the walk speed from server to get kicked.
That doesn’t work though. It seems changes on the client don’t replicate to the server, so checking the walkspeed is useless. That’s why I tried using the CFrame, Vector3, to guess when they are trying to speed hack
I would check the players humanoid root part velocity every .Stepped to see if it ever gets too high. You should never kick a player on suspicion of exploiting as high velocity can be caused by falling or being flung.
Every stepped you can store the players last velocity (Part.Velocity.Magnitude) then compare on the next frame to see if there are any huge differences. I would also keep a minimum velocity value and a maximum one.
You misunderstand how the client-server relationship works.
stuff that is on the localplayer, hackers have full control.
that’s why it can still work, and is also why hackers can just change walkspeed and speedhack. Humanoid manipulation is still viable for hackers. In the roblox developer API reference, you can see what is replicated and what isn’t, as well as what property of said item is replicated and what isn’t. I hope you understand what I mean.
i suggest using a module script (they can still access the localplayer), place module.functions in the module and then requiring the module in a server script. also place in serverscriptservice since the localplayer can’t see server sided stuff
one more edit: btw, anything that won’t be cloned and given to client and instead to the server (like in workspace), put in serverstorage so they can’t see it.