How do I make an Idle sound stop when unequipped

(FE GUN KIT)


I added the IdleSound code.

I am no coder, but I know a little bit, but when I unequip the gun, the idle sound doesn’t stop.

Here is an example:

The song keeps playing, how do I make it stop after I unequip it?

(credits to JJBA for the sounds or something)

Show the whole code in a code block. It will be easier to fix it for me and potentially others.

I don’t know how to do code block, and the code is about 2667 lines long.
I haven’t used the forums in over a year, can I just send you a model of the code?

line 2404 is the idlesound code

(NOT MY SCRIPT)


Uh… I have a small problem.

Alright, I turned on allow copying, now help me please.

How to code block (can be used in the future):

  1. Open a script
  2. Click somewhere in the script editor
  3. Ctrl + A
  4. Go to DevForum
  5. Make a new reply
  6. Press Enter once
  7. Ctrl + V
  8. Ctrl + A
  9. Ctrl + E

Use the Unequipped Event.

Tool.Unequipped:Connect(function()
    Handle.IdleSound:Stop()
end)

Wait, I think I know a fix for it, sorry, I wasn’t using my brain, I guess lol.
I have to do

Tool.Unequipped:connect(function()
Handle.IdleSound:Stop()
SmokeTrail:StopEmission()
if Module.ChargedShotAdvanceEnabled then
Charging = false

right?

2 Likes

I was going to mention that, you solved it by yourself.

1 Like