The script is in a tool, and it is supposed to increase the player's speed when they equip it, and return their speed back to normal when they unequip it.
However, the script isn't working at all, and I don't know why. I did get output, however.
Can someone please help me?
Here's the script:
script.Parent.Equipped:connect(function() script.Parent.Handle.CoilSound:Play() if script.Parent.Parent:FindFirstChild("Humanoid") then script.Parent.Parent.Humanoid.WalkSpeed = 32 end end) script.Parent.Unequipped:connect(function() script.Parent.Handle.CoilSound:Play() if script.Parent.Parent:FindFirstChild("Humanoid") then script.Parent.Parent.Humanoid.WalkSpeed = 16 end end)
Output: "Equipped is not a valid member of Model"
One thing to note, from what I have tested it will not work if there is no part in the Tool
named Handle
.
Here is the code for a LocalScript
you can use, not sure why you're script won't work though.
Sorry I couldn't explain it any better.
wait(0.5) -- Prevent error's while searching for the player local player = game.Players.LocalPlayer -- Easier way then repeating it alot of times script.Parent.Equipped:connect(function() -- Equipped function script.Parent.Handle.CoilSound:Play() -- Play the sound if player.Character:FindFirstChild("Humanoid") then -- Search for the Humanoid player.Character.Humanoid.WalkSpeed = 32 -- Change the walkspeed end -- End the search end) -- End the function -- Won't explain below cause it is pretty much the same. script.Parent.Unequipped:connect(function() --script.Parent.Handle.CoilSound:Play() if player.Character:FindFirstChild("Humanoid") then player.Character.Humanoid.WalkSpeed = 16 end end)