Help changing player speed with a tool

I need to change player speed with a LocalScript, but the player speed either does not change or only changes once.

Script:

script.Parent.Equipped:Connect(function()
	game.Players.LocalPlayer.Humanoid.WalkSpeed = 12
end)

script.Parent.Unequipped:Connect(function()
	game.Players.LocalPlayer.Humanoid.WalkSpeed = 16
end)
script.Parent.Equipped:Connect(function()
	game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 12
end)

script.Parent.Unequipped:Connect(function()
	game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16
end)
1 Like
script.Parent.Equipped:Connect(function()
	game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 12
end)

script.Parent.Unequipped:Connect(function()
	game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16
end)

This should work.

2 Likes
local char = game.Players.LocalPLayer.Character
script.Parent.Equipped:Connect(function()
	char.Humanoid.WalkSpeed = 12
    print(char.Humanoid.WalkSpeed.."is the walk speed when equiped")
end)

script.Parent.Unequipped:Connect(function()
	char.Humanoid.WalkSpeed = 16
    print(char.Humanoid.WalkSpeed.."is the walk speed when unequiped")
end)

try some debugging and see if it prints what is expected

It does not print anything, the walk speed does not change for some reason.

local plr = game.Players.LocalPlayer
local char = plr.CharacterAdded:Wait()
script.Parent.Equipped:Connect(function()
	char.Humanoid.WalkSpeed = 12
    print(char.Humanoid.WalkSpeed.."is the walk speed when equiped")
end)

script.Parent.Unequipped:Connect(function()
	char.Humanoid.WalkSpeed = 16
    print(char.Humanoid.WalkSpeed.."is the walk speed when unequiped")
end)

@ZINTICK 's code is right, but you gotta wait for the character to load in order for the code to run sometimes since the script can sometimes begin running before anything physical loads in the game.

I modified his code just adding a wait on top. I tested that and it worked for me. Should work for you.

1 Like