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

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

Asked by 3 years ago

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

Log in to vote
0
Answered by
NGC4637 602 Moderation Voter
3 years ago

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)
0
Thank you SvelteSorcererY 2 — 3y
0
there is an accept answer button that you can press here>.>  NGC4637 602 — 3y
0
Why does this not work for me? In the Script Analyser, It says " Unknown global 'Tool' " BasileCats 0 — 3y
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 NGC4637 602 — 3y
Ad

Answer this question