So here is the portion of my anti-cheat that has walkspeed
local Player = game:GetService("Players").LocalPlayer -- gets the player local Char = Player.Character or Player.CharacterAdded:Wait() -- gets their character local Hum = Char:WaitForChild("Humanoid") -- gets the character's humanoid Hum:GetPropertyChangedSignal("WalkSpeed"):Connect(function(Speed) -- If the walkspeed changed the function fires if (Hum.WalkSpeed >= 51) then -- if it's greater than gamepasses can buy it local ban = game.ServerScriptService.AntiSpeed.Ban -- sound for added effect ban.Play() wait(0.584) -- length of the sound Player.kick(Player.." your speed is too high! As a result, you were kicked.") -- kick script end end)
I have also tried putting it in a while true do
while true do Hum:GetPropertyChangedSignal("WalkSpeed"):Connect(function(Speed) if (Hum.WalkSpeed >= 51) then local ban = game.ServerScriptService.AntiSpeed.Ban ban.Play() wait(0.584) Player.kick(Player.." your speed is too high! As a result you were kicked.") end end) end
If anyone could help that would be highly appreciated. This is in a normal script put in ServerScriptStorage. FE is off.
You have to use:
Player:Kick() --instead of Player.Kick()
This is because Kick is not something of the player, but an action. And you cannot get local player from server script. Use this:
game.Players.PlayerAdded:Connect(function(plr) -- your things end)