I’ve been working on a script that kicks you when your walkspeed is above the maximum limit
When i click ‘play’, and change my WS, i cant get kicked as there are errors on the first two lines
Output:
11:33:16.385 ServerScriptService.Anti-Exploit.Configuration.ModuleScript:4: attempt to call a nil value - Server - ModuleScript:4
11:33:16.386 Stack Begin - Studio
11:33:16.387 Script ‘ServerScriptService.Anti-Exploit.Configuration.ModuleScript’, Line 4 - Studio - ModuleScript:4
11:33:16.388 Stack End - Studio
11:33:16.521 Requested module experienced an error while loading - Server - Script:2
11:33:16.522 Stack Begin - Studio
11:33:16.523 Script ‘ServerScriptService.Anti-Exploit.Script’, Line 2 - Studio - Script:2
11:33:16.523 Stack End - Studio
11:32:52.215 StartProcessException… - Studio
11:33:07.066 Uploading crash analytics… - Studio
11:33:07.105 Done uploading crash analytics - Studio
11:37:43.237 Disconnect from ::ffff:127.0.0.1|55690 - Studio
For Starters I dont think you can just straight up say if Humanoid.WalkSpeed > 16 then kick the player on the server because they would be changing it on the client so this wouldnt work in the first place I dont think.
if IsHuman.WalkSpeed <= WalkSpeed then
return
else
player:Kick()
end
Also as said in your module you are returning the table not actually config.humanoid so instead of making it two different things just do local config = {} to make it simple. Also you want to check if it is equal too or less that so that you can actually check if it is more than.
For the server script, instead of iterating over the workspace’s children, you should just iterate over each player’s character.
for _,plr in pairs(game.Players:GetPlayers()) do
if plr.Character and plr.Character:FindFirstChildOfClass("Humanoid") then -- check player has a character and has ahumanoid
if plr.WalkSpeed > WalkSpeed then
plr:Kick("bad boy")
end
end
end
local module = script.Parent.Configuration.ModuleScript
local getmodule = require(module)
function CheckVariables()
local t = getmodule.humanoid
local WalkSpeed = t.Anti_WalkSpeed
local WS_Value = t.WalkSpeed
if WalkSpeed == false then return
elseif WalkSpeed == true then
for _,plr in pairs(game.Players:GetPlayers()) do
if plr.Character and plr.Character:FindFirstChildOfClass("Humanoid") then -- check player has a character and has ahumanoid
if plr.WalkSpeed > WS_Value then
plr:Kick("Kicked for irregular WalkSpeed")
end
elseif plr.Character and not plr.Character:FindFirstChildOfClass("Humanoid") then
plr:Kick("Kicked for irregular WalkSpeed")
end
end
end
end