equipped = true
script.Parent.Equipped:connect(function(mouse)
Looped = true
tool = script.Parent
Handle = tool:WaitForChild'Handle'
sound = Handle:WaitForChild'Sound'
tool.Activated:connect(function()
sound:Play()
sound.Looped = true
equipped = false
Parent.Unequipped:connect(function()
sound.Looped = false
end)
end)
end)
✓ ANSWER ACCEPTED
My tool is supposed to end the loop sound when unequipped, anybody know how to fix it?
1 answer
✓ Accepted answer
Here, this should be your solution:
local tool = script.Parent
local handle = tool:FindFirstChild("Handle")
local sound = handle:FindFirstChild("Sound")
equipped = false
script.Parent.Equipped:connect(function()
equipped = true
sound.Looped = true
sound:Play()
end)
script.Parent.Unequipped:connect(function()
equipped = false
sound:Stop()
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

5 comments
Thank you!
There is actually an error that occured in this script some how and it has to do with the = on the second line where it says handle = tool... I have no idea why but I trust your coding, is there something you could have possibly done wrong?
Oh, my bad! Try using this on the 2nd line: local handle = tool:FindFirstChild("Handle"). I accidentally added in 2 equal signs.
I'll make sure to edit my answer to fix these typos so you can easily replace it.
Thank you, I'm sure it will work very well, it actually does help me alot because I am coding for one of my friends as we are both not very good coders but I am just that much better that he asked me to, and I really appreciate your help, thank you!