You can’t really do anything about exploiters changing their walkspeed.
Yes, you can. If you want, you can copy and paste the script into studio (On the server) and give it a try yourself. When you change the player speed on the client, it kicks you, but when you change it on the server, it doesn’t.
But exploiters can easily change that localscript?
Nevermind this actually works since the walkspeed is set on the server.
RayOrigin = Root.Position
RayDirection = Vector3.new(0, -100,0)
and then just use the code on the wiki for raycasts, make the blacklist Character:GetDescendants()
Maybe setting a limit for the player’s walk speed? So if the walk speed exceeds than, you can set it back.
There might be a problem with client-server.
the Running function just returns the characters overall speed, not there walkspeed, you are faster on a conveyor belt thus it returns that instead of its walkspeed
trying printing out “speed”, you will notice how it would be printing out numbers that aren’t your walkspeed often
I re-maken your code, cause there could be 2 whitelisted WalkSpeed. I don’t know why I re-maken it, but, honestly:
local whitelistedSpeed1 = 16
local whitelistedSpeed2 = convoyorspeedhere
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local hum = character:WaitForChild("Humanoid")
if hum.WalkSpeed ~= whitelistedSpeed1 or whitelistedSpeed2 then
player:Kick("hi there ur hacks are cool now get out of here :)")
end
end)
end)
Also, putting it on the client is a risk.
Problem is that if there were variations of conveyor speeds then what is the point of that?
That’s not how or statements work. That will kick the player every time. Look on the Dev hub on how or statements work.
What you are doing right now in pseudo code:
(Walkspeed is not equal to white list speed 1) or (white list speed 2 exists)
Whitelist speed 2 always exists
Sorry to inform, but it takes an exploiter way less time to delete this script then it takes you to write it. Anti cheats on the client are never a good option. An exploiter can simply delete or disable your scripts.
In addition, exploit detection scripts based off any information provided by the client should never be trusted as anything the client tells you can be easily manipulated. As @Sensei_Developer stated on their reply, you should be worrying about making server protection instead.
I suggest you check out this post. It’s one of the greatest community resources ever posted in the developer forum.
I have literally said about 50 times, THIS IS ON THE SERVER. Please read the whole post and replies, as I did state this quite a few times.
If you would like to try the script yourself, just copy and paste into studio on the server. I can assure you, it will work. If you change walk-speed on the client and walk, it will kick you, but if you change on the server, it won’t.
local whitelistedSpeed1 = 16
local whitelistedSpeed2 = convoyorspeedhere
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local hum = character:WaitForChild("Humanoid",30) -- wait 30 before declare (infinity yield with waitforchild and continue withoud ever finding it)
if not hum or not hum:IsA("Humanoid") then
-- to make sure player didnt rename his humanoid or remove it or renamed it and name somthing else humanoid cause it replicated to the server from what i heard with roblox characters
--kickhere (warning if hes legit and takes longer then 30 seconds to spawn he also get kicked increase to ur liking)
elseif hum.WalkSpeed ~= whitelistedSpeed1 or hum.WalkSpeed ~= whitelistedSpeed2 then
--kick() --some speedy boy
end
end
end)
end)
exploiters can destroy any individual object in their characters, including non-physical items like decals, joints, and scripts, and that destruction replicates to the server.
this is only for character so keep that in mind so make sure to add checks in case he tries to break ur script by changing names or removing stuff
probaly forgot something
I still can’t grasp on why you still need an anti-exploit for, I presume, a tycoon game. Unless there is a PVP or items dropped randomly in random places, anti-speed is useless if it is a tycoon game that only requires you to place machines.
There are multiple ways to detect sudden change in speed, however these have its downside as well.
- Velocity check
- Probably the most used method. If the overall velocity of the HumanoidRootPart is greater than the average velocity, it could be well count as anti-speed. However, I am not sure if a conveyer can directly affect this velocity check. Also, if there are perks that increases the speed of the player or if you allow flying, then this method will probably not work unless you know the formula for calculating the average velocity of the HumanoidRootPart.
- Magnitude check
- This can be done on the server. Compare the magnitude of the previous Position of the HumanoidRootPart and the latest Position of the HumanoidRootPart. If their distance is not in the average, then it could be count as an speed exploit. The biggest downside to this is the replication of the character, or basically lag.
It is impossible to make a perfect anti speed exploit. The best way to prevent exploit is to secure your algorithms; always check on the server for player inputs like purchasing.
No, I am making an obby, so I obviously don’t want people to speed through it. For more info, see this post I made, where you can see more of the game: Horizontal position bar not working properly
what about teleport for _,v in pairs(folderwithcheckpoints:GetChildren()) do
–game.Players.LocalPlayer.Character:SetPrimaryPartCFrame(v.CFrame)
i know this ain’t complete but the point is teleport is waaay more of a priority for an obby then speed hacks
in my opinion a speed hack or jumpower is a obby is not somthing u have to worry about its not a competitive game with global leaderboard or something
Sorry, but what is this code for?
for teleporting u need to check 2 positions between interval if distance is too big for a player to be legit traveled with a bit of extra for margin for lag then hes teleporting
something like that