Basic Anti-Speed Script

This is a simple serverside anti speed script which scales with walkspeed.

I recommend using CloneTrooper1019’s FastWait module for better accuracy.

> --//Functions
    > local function CharacterThread(Chr)	
    > 	--//Main
    > 	coroutine.resume(coroutine.create(function()
    > 		--//Vars
    > 		local Hum = Chr:WaitForChild("Humanoid")
    > 		local Root = Chr:WaitForChild("HumanoidRootPart")
    > 		--
    > 		if not Hum or not Root then return end
    > 		
    > 		--//Logic Vars
    > 		local lastSpeedChange = 0
    > 		local LastCFrame = Root.CFrame
    > 		
    > 		--//Hooks
    > 		Hum:GetPropertyChangedSignal("WalkSpeed"):Connect(function()
    > 			lastSpeedChange = tick()
    > 		end)
    > 		
    > 		--//Function
    > 		local function Check()
    > 			local ThisPosition = Vector3.new(Root.Position.X,0,Root.Position.Z)
    > 			local LastPosition = Vector3.new(LastCFrame.Position.X,0,LastCFrame.Position.Z)
    > 			local Distance = (ThisPosition - LastPosition).Magnitude
    > 			local WalkSpeed = Hum.WalkSpeed
    > 			--
    > 			if Distance > (WalkSpeed + 3) then
    > 				Root.CFrame = LastCFrame
    > 			end
    > 		end
    > 		
    > 		--//Loop
    > 		while true do
    > 			LastCFrame = Root.CFrame
    > 			wait(1)
    > 			if tick() - lastSpeedChange >= 1 then
    > 				Check()
    > 			end
    > 		end
    > 		
    > 	end))
    > 	
    > end
    > 
    > --//Hooks
    > game.Players.PlayerAdded:Connect(function(Plr)
    > 	Plr.CharacterAdded:Connect(function(Chr)
    > 		CharacterThread(Chr)
    > 	end)
    > end)
14 Likes

If the player starts falling then this script will break(false-positive).

4 Likes

Would you mind expanding on that? Because I don’t see it.

The player falls at a higher speed than what the script expects, so the script will detect that the player is moving very fast, therefore giving a false-positive(false-positives are just things that were thought to be correct but wasn’t).

I don’t see anything in the script which would pick up a change in height of the player.

3 Likes

My bad, didn’t notice that.

The script does not take vertical position into account therefore it will not cause a false positive.

1 Like

Sorry to revive this topic. Where should i place this script? I assume ServerScriptService? And would this affect a monster npc that walks around with an AI script? Thanks!

No it wouldn’t lol, it’s only checking real players and real humanoids, the game.Players.PlayerAdded event only fires for players, and I doubt the npc uses walk speed, most of them use cframe, vector movement.