Setting values on the client wont kick the player

even if i change the value of walkspeed on the client it still wont kick me here is some sample code

function AntiExploit:AntiSpeed(player, humanoid)
	if humanoid.WalkSpeed > List.WalkSpeed then
		if game.Players:FindFirstChild(player.Name) then
			player:Kick("Get yeeted")
		end
	end
end

i am also calling this function from a server script

3 Likes

Are you sending a remote event to the client? Because walkspeed doesn’t replicate to the server only their position does. You need to have a local script in the client side checking if the person changed something

this code is inside a module script meaning it can do server and client things

im calling this function in a server script

1 Like

The thing is if you call it in a server script it will do things the server can do and if you call it from the client it can do things only the client can do

(At least that’s how I understand it)

i just said it is from the module script the function i am only calling it in the server

1 Like

I’m going to test a few things out on my pc just a sec

The WalkSpeed is not replicated from the client to the server. Will you need to use another method such as a magnitude check between two points and compare the distance to the desired WalkSpeed. The client will be able to set this value to whatever and the server will not receive the changes so by comparing distances, you are not relying on the WalkSpeed value which can be inaccurate on the server. Hope this helps!

1 Like

im calling those functions on the server and the functions are inside the module

ok i tried both calling it on a server script and local script and the server script did not work but the local script did so you need to check on a local script because walkspeed doesn’t replicate to the server and you cannot detect it.

Hope it helped :smiley:

this is how my set up for the anti exploit looks like

But the main thing is that you are calling the functions from a server script. This means that it is only running server side. A module does not replicate in the way you are thinking. Calling the function on the client will do what you hope it does whereas doing it on the server will not check for changes the client has made.

1 Like

so i will make a local script to make that function kick the player from the client? if they ever change values from the client

1 Like

Yep! This will stop other exploiters that do not have much scripting knowledge but for the other exploiters you may need to do magnitude checks and other exploiting prevention methods :slight_smile:

This isn’t the best method as client side anti-exploit can be bypassed although it work better than currently and will catch out basic exploiters. Look to the method I stated before with comparing positions on the server for better results but for a start, client side anti-exploit would do the trick!

its a module and i will watch them if they remove the local script and the module script and if they remove it ill simply do something about it

Any other methods?

1 Like

that is not how modules work
you’ll need to send the client’s walkspeed to the server via a remote event for it to actually recognize it
other than that, having it in a seperate script is pretty much useless, i suggest nesting it in game-requiring scripts

thats a bad method bc they can fake it by firing an event of 16 as an argument

1 Like

This can be spoofed by a client that is exploiting and should not be used.

1 Like

any other methods that i can use to replicate it to the server?

Just run magnitude checks on a server script to compare the distances that the character has travelled. Here is a basic example:

local LastData = {}
while wait(1) do
	for _, Player in pairs(game:GetService("Players"):GetPlayers()) do
		if Player.Character then
			if Player.Character:FindFirstChildOfClass("Humanoid") and Player.Character:FindFirstChild("HumanoidRootPart") then
				if Player.Character:FindFirstChildOfClass("Humanoid").FloorMaterial then
					if not LastData[Player.UserId] then
						LastData[Player.UserId] = {
							Position = Player.Character.HumanoidRootPart.Position,
							Tick = tick(),
						}
					end
					if (LastData[Player.UserId].Position - Player.Character.HumanoidRootPart.Position).Magnitude > Player.Character:FindFirstChildOfClass("Humanoid").WalkSpeed + 1 * (tick() - LastData[Player.UserId].Tick) then
						Player:Kick("Moving too fast!")
					else
						LastData[Player.UserId] = {
							Position = Player.Character.HumanoidRootPart.Position,
							Tick = tick(),
						}
					end
				end
			end
		end
	end
end

Note that changes may need to be made to that code to account for players moving faster than the walkspeed for gameplay reasons or whatever.