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

Why won't this local script work, It's supposed to change speed?

Asked by 7 years ago

I made this local script where it changes the speed of the player when equipped, unequipped, and activated but it doesn't work. Any help?

local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:wait()
local humanoid = char:WaitForChild("Humanoid")
local tool = script.Parent

function slowdown()
    humanoid.Walkspeed = 100
end

function freeze()
    humanoid.Walkspeed = 0
    wait(0.67)
    humanoid.Walkspeed = 10
end

function speedup()
    humanoid.Walkspeed = 16
end

tool.Actived:connect(freeze)
tool.Equipped:connect(slowdown)
tool.Unequipped:connect(speedup)

1 answer

Log in to vote
1
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
7 years ago
tool.Actived:connect(freeze)

You just made a typo. The output would have told you where the error was, so in the future please try to catch these mistakes yourself :)

This needs to be:

tool.Activated:connect(freeze)
Ad

Answer this question