Hello, So For today, im trying to make a Simple Anti-Cheat that See the Players WalkSpeed and Kicks them if its more than 20
So the Code im using is
game.Players.PlayerAdded:Connect(function(plr)
local Char = plr.CharacterAdded
local Humanoid = Char:FindFirstChild("Humanoid")
if Humanoid.WalkSpeed > 20 then
plr:Kick('Speed Hacking')
end
end)
So the Error i get in the Output is “FindFirstChild is not a valid member of RBXScriptSignal”
So from What I See i think it saying the Part where i write
Char:FindFirstChild("humanoid") -- i think This Is Wrong
You would have to replace that with the line that defines your character:
game.Players.PlayerAdded:Connect(function(plr)
if not plr.Character then
plr.CharacterAdded:Wait()
end
local Char = plr.Character
local Humanoid = Char:FindFirstChild("Humanoid")
if Humanoid.WalkSpeed > 20 then
plr:Kick('Speed Hacking')
end
end)
game.Players.PlayerAdded:Connect(function(plr)
if not plr.Character then
plr.CharacterAdded:Wait()
end
local c = plr.Character
local Humanoid = c:FindFirstChild("Humanoid")
if Humanoid.WalkSpeed > 20 then
plr:Kick('Speed Hacking')
end
end)
There is really no point in trying to check the WalkSpeed value of the humanoid on the server, because exploits change the walkspeed on the client, which does NOT replicate to the server
there is things to stop speed hacks, such as checking the moved magnitude every second and comparing it to the last time it was checked, or checking if the walkspeed is changed on the client and firing a remote event to see if it is the same on the server or not.
game.Players.PlayerAdded:Connect(function(p)
p.CharacterAdded:Connect(function(c)
local hum = c.Humanoid
hum.Running:Connect(function(speed)
if speed > 20 then
print(“Player is hacking”)
end
end)
end)
end)
game.Players.PlayerAdded:Connect(function(plr)
local Char = game.Workspace:WaitForChild(plr.Name)
local Humanoid = Char:FindFirstChild("Humanoid")
if Humanoid.WalkSpeed > 20 then
plr:Kick('Speed Hacking')
end
end)