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

How do I make my tool play a sound when a player is holding it?

Hi. I am making a game that is similar to sea of thieves. I have already made my tool models in blender.

But how do I make my tool play a Sound when a player is holding it?

I've already figured out how to make the tool play an animation while a player is holding it, but I am having trouble making my tool play a sound when a player is holding it. Thanks

1 answer

✓ Accepted answer

with the Tool.Equipped and Tool.Unequipped Event.

local sound = Instance.new("Sound",Tool)
sound.SoundId = "(insert sound id here)"
sound.Looped = true

Tool.Equipped:Connect(function()
	sound:Play()
end)

Tool.Unequipped:Connect(function()
	sound:Stop()
end)

4 comments

0

Thank you

0

there is an accept answer button that you can press here>.> 

0

Why does this not work for me? In the Script Analyser, It says " Unknown global 'Tool' "

0

because I said tool as an example. You have to know where your tool is at. so if it in workspace, do game.Workspace.(tool name here) instead of Tool

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