Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
hkmag 0
6 years ago
Edited 6 years ago

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

Log in to vote
-1
Answered by 6 years ago

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)


0
try chaging _G.Play into (_G.Play.Value == true) in lines 15 and 18 naturewizard 85 — 6y
0
@naturewizard when I do that I get "attempt to index field "Play" (a boolean value)" hkmag 0 — 6y
0
Oh sorry, try making it (_G.Play == true) in lines 15 and 18 naturewizard 85 — 6y
0
Thank you it works. :) hkmag 0 — 6y
Ad

Answer this question