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

tool's local script refuse to work after character resets or die?

Asked by 4 years ago

So, I'm having a problem where the local script won't work anymore after the player resets for some reason, if anyone can give any assistance it would be very much appreciated.

local plr = game.Players.LocalPlayer
local chara = plr.Character
local hum = chara:FindFirstChild("Humanoid")
local speed = script.Parent.Speed

script.Parent.Equipped:connect(function()
 if hum then
  hum.WalkSpeed = speed.Value
 end
end)

script.Parent.Unequipped:connect(function()
 if hum then
  hum.WalkSpeed = 16
 end
end)

Note: the "speed" value is a "IntValue"

Another note: the tool is supposed to be a speed coil if anyone is wondering.

Answer this question