Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Walkspeed checker only works in studio? [anti-exploit] [SOLVED]

I am making a game with changing walkspeed but it isnt working properly. This is the code:

local Player = game.Players.LocalPlayer
humanoid = script.Parent:WaitForChild("Humanoid")


function antispeedhack()
    if humanoid.WalkSpeed ~= 25 then 
    local remoteevent = game.ReplicatedStorage:WaitForChild("Kick")     

        remoteevent:FireServer("Kick")
    end
end

humanoid.WalkSpeed.Changed:connect(antispeedhack)

1 answer

✓ Accepted answer

A good way to kick exploiters is using Local Scripts.

A local script in the StarterPlayerScripts would do fine.

local Player = game.Players.LocalPlayer
humanoid = script.Parent:WaitForChild("Humanoid")


function antispeedhack()
	if humanoid.WalkSpeed >= 26 then --26 should act as the threshold for which if a person is speedhacking and making their walkspeed greater than 26 the kick script should trigger.
	--Your kick script
	local remoteevent = game.ReplicatedStorage:WaitForChild("Kick")     

        remoteevent:FireServer("Kick")
	end
end

humanoid.WalkSpeed.Changed:connect(antispeedhack)


4 comments

0

try chaging _G.Play into (_G.Play.Value == true) in lines 15 and 18

0

@naturewizard when I do that I get "attempt to index field "Play" (a boolean value)"

0

Oh sorry, try making it (_G.Play == true) in lines 15 and 18

0

Thank you it works. :)

This discussion is preserved as it was. New answers, comments, and votes are closed.