(08-20-2018, 04:41 AM)NiLSPACE Wrote: Does it send 'nil' values or the actual number 0?
In the code above it's sending me the number 0, but in this code (yes, it is an anti cheat and I know that somebody else is doing this already)
function speedCheck(Player) -- called in OnPlayerMoving -- Horizontal speed check(doesn't include swimming) speed = Player:GetSpeedX() + Player:GetSpeedZ() -- if the player is sprinting if Player:IsSprinting() ~= nil then -- if he is faster than the max sprinting speed if speed > Player:GetSprintingMaxSpeed() then -- stop his movement return true -- if not else -- let the player move return false end -- if the player is flying elseif Player:IsFlying() ~= nil then -- if he is faster than the max flying speed if speed > Player:GetFlyingMaxSpeed() then -- stop his movement return true -- if not else -- let the player move return false end -- if the player is not sprinting and not flying he is walking normally else -- if he is faster than the max normal speed if speed > Player:GetNormalMaxSpeed() then -- stop his movement return true -- if not else -- let the player move return false end end-- Horizontal speed check(doesn't includes swimming) speed = Player:GetSpeedX() + Player:GetSpeedY() -- if the player is sprinting if Player:IsSprinting() then -- if he is faster than the max sprinting speed if speed > Player:GetSprintingMaxSpeed() then -- stop his movement return true -- if not else -- let the player move return false end -- if the player is flying elseif Player:IsFlying() then -- if he is faster than the max flying speed if speed > Player:GetFlyingMaxSpeed() then -- stop his movement return true elseif Player:CanFly() == false then return true -- if not else -- let the player move return false end -- if the player is not sprinting and not flying he is walking normally else -- if he is faster than the max normal speed if speed > Player:GetNormalMaxSpeed() then -- stop his movement return true -- if not else -- let the player move return false end end end
it is sending me this error:
Code:
Warning: [23:03:44] LUA: Plugins/RAW_ac/checks/movement.lua:5: attempt to call method 'GetSpeedX' (a nil value)
Warning: [23:03:44] Stack trace:
Warning: [23:03:44] Plugins/RAW_ac/checks/movement.lua(5): (no name)
Warning: [23:03:44] (tail call)(-1):
Warning: [23:03:44] Stack trace end
Warning: [23:03:44] Error in <attached> calling function <callback>()
Hope that this helps.
Sincerely G3bE