I am making a game with changing walkspeed but it isnt working properly. This is the code:
local Player = game.Players.LocalPlayer humanoid = script.Parent:WaitForChild("Humanoid") function antispeedhack() if humanoid.WalkSpeed ~= 25 then local remoteevent = game.ReplicatedStorage:WaitForChild("Kick") remoteevent:FireServer("Kick") end end humanoid.WalkSpeed.Changed:connect(antispeedhack)
A good way to kick exploiters is using Local Scripts.
A local script in the StarterPlayerScripts would do fine.
local Player = game.Players.LocalPlayer humanoid = script.Parent:WaitForChild("Humanoid") function antispeedhack() if humanoid.WalkSpeed >= 26 then --26 should act as the threshold for which if a person is speedhacking and making their walkspeed greater than 26 the kick script should trigger. --Your kick script local remoteevent = game.ReplicatedStorage:WaitForChild("Kick") remoteevent:FireServer("Kick") end end humanoid.WalkSpeed.Changed:connect(antispeedhack)