This is just as bad. The best solution for anti-walkspeed exploits is checking the player’s position on the server end, and comparing it to an older position.
This is just showing him an example
Here’s a method I use in pretty much all of my games. Put this in a server script.
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
char:WaitForChild('Humanoid').Running:Connect(function(speed)
if speed > 20 then
player:Kick("Exploiting")
end
end)
end)
end)
if game.Player.LocalPlayer.Character.Humanoid.WalkSpeed ~= 16 Then
game.Player.LocalPlayer:Kick()
end
That is false, Roblox gives all character control to the client and sends the character position to the server.
Again, that’s false, the one thing that Roblox allows players to have complete control over is there “character” movement, which does replicate to the server.
no. the character is owned by the player so if the player has high ping it could cause their speed to change in slow but big intervals that normaly wouldnt be possible.
You’re using game.Player…
The service is called ‘Players’. You can access it via game:GetService(“Players”) or game.Players.
(Unrelated to the problem) While I do believe :kick() still works, :Kick() is kind of what Roblox intends to be used universally. It’s kind of like how you can use :connect, but :Connect is the standard.
So here’s a quick fix to get my point across a bit better.
--[[
if game.Player.LocalPlayer.Character.Humanoid.WalkSpeed ~= 16 then
game.Player.LocalPlayer:Kick()
end
]]--
local Player = game:GetService'Players'.LocalPlayer; -- Notice "Players", not "Player".
if (Player.Character.Humanoid.WalkSpeed ~= 16) then
Player:Kick() -- Uppercase Kick is the standard.
end
Hope this helps.
I hope you find my code useful, it isn’t very reliable for you to depend on the client to check the player’s walk speed. Instead; consider checking the magnitude at which the player is moving at (real-time walking speed).
-- Server scripts should be used more often as a method to patching exploits.
local Players = game:GetService("Players")
local FindFirstChildWhichIsA = game["FindFirstChildWhichIsA"]
local WaitForChild = game["WaitForChild"]
local OnCharacterAdded; OnCharacterAdded = function(Character)
local Humanoid =
FindFirstChildWhichIsA(Character, "Humanoid")
WaitForChild(Character, "Humanoid")
local RootPart = Humanoid.RootPart or WaitForChild(Character, "HumanoidRootPart")
local RBXScriptConnection; RBXScriptConnection = Humanoid.StateChanged:Connect(function(LastState, CurrentState)
if CurrentState == Enum.HumanoidStateType.Running then
local MovementSpeed = (RootPart.AssemblyLinearVelocity * Vector3.new(1, 0, 1)).Magnitude
if MovementSpeed >= 80 then
-- Potentially cheating?
-- This could be faulty, so I would recommend only checking for absurd numbers.
return RBXScriptConnection.Disconnect(RBXScriptConnection)
end
end
end)
end
local OnPlayerAdded; OnPlayerAdded = function(Player)
Player.CharacterAdded:Connect(OnCharacterAdded)
end
Edit: Humanoids do take a brief moment to accelerate, so it wouldn’t be a biggie to give a shot at lower numbers.