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

How to give walkspeed when equpping tool?

So I have a script on a speed coil but I can't figure out how to give the person speed when they equip it.

local speed = script.Parent.Speed.Value
local Tool = script.Parent

Tool.Equipped:Connect(function()
	game.Humanoid.WalkSpeed = speed
end)

Tool.Unequipped:Connect(function()
	game.Humanoid.Walkspeed = 16
end)

1 answer

local script inside tool

local Speed = script.Parent.Speed
local Tool = script.Parent
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")

Tool.Equipped:Connect(function()
	Humanoid.WalkSpeed = Speed.Value
end)

Tool.Unequipped:Connect(function()
	Humanoid.WalkSpeed = 16
end)

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