Hello, I have a script inside of a tool that plays a song when it is pulled out, however once it is put away the music still plays and keeps playing in the area where the tool was put away. How can I stop the music from playing after its been de-equipped? Here's the script, the sound is in the handle
local Tool = script.Parent;
enabled = true
function onActivated()
if not enabled then
return
end
enabled = false
local h = Tool.Parent:FindFirstChild("Humanoid")
if (h ~= nil) then
if (h.MaxHealth > h.Health + 0) then
h.Health = h.Health + 0
else
h.Health = h.MaxHealth
end
end
enabled = true
end
function onEquipped()
wait(0.1)
Tool.Handle.EquipSound:play()
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)

2 comments
Thanks
It still plays after putting it away