Why is this playing this sound when I don't want it to?

Hey there developers,

So, I have this LocalScript in StarterPlayerScripts and for some reason this weird thing that happend:

So, there is a line of code that specifies this:

local takeoff = game.Workspace.Nuke.Takeoff
			takeoff.Parent = workspace
			takeoff:Play()

and then there is a line of code that says this:

local boom = game.Workspace.Nuke.Boom
			boom.Parent = workspace
			boom:Play()

But for some reason, when I try playing the boom sound (second code) it plays the first line that is the sound of a jet taking off.

If you want the whole script, it’s down below:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage.NukeEvent

local plrs = game:GetService("Players")
local plr = plrs.LocalPlayer

local function onClientReceive()
	warn("The nuke has been launched!")
	game.Workspace.Nuke.Missle.Base.Anchored = true

	local debounce = false
		if debounce == false then
			debounce = true

			local siren = game.Workspace.Nuke.Siren
			siren.Parent = workspace
			siren:Play()
			local notif = game.Workspace.Nuke.Notification
			notif.Parent = workspace
			notif:Play()
			plr.PlayerGui.NukeWarning.Enabled = true

			coroutine.resume(coroutine.create(function()
				local lights = game.Workspace.Nuke.Lights:GetChildren()
				for i=1,25 do
					for i,v in pairs(lights) do
						v.SpotLight.Enabled = true
					end
					wait(1)
					for i,v in pairs(lights) do
						v.SpotLight.Enabled = false
					end
					wait(1)			
				end
			end))

			wait(3)

			game.Workspace.Nuke.Missle.Base.Fire.Enabled = true
			game.Workspace.Nuke.Missle.Base.Smoke.Enabled = true
			
			local TweenService = game:GetService("TweenService")
			local Door = workspace.Bunker.BunkerDoor

			local goal = {}
			goal.Position = Vector3.new(324.1, -7.05, 58.6)

			local goaltwo = {}
			goaltwo.Position = Vector3.new(324.1, 7.35, 58.6)

			local tweenInfo = TweenInfo.new(3)

			local open = TweenService:Create(Door, tweenInfo, goal)
			local close = TweenService:Create(Door, tweenInfo, goaltwo)
			
			open:Play()
			game.Workspace.Bunker.BunkerDoor.Door:Play()
			game.Workspace["Warhead Control Facility"].NukeTrapdoor.Union.Transparency = 1
			game.Workspace["Warhead Control Facility"].NukeTrapdoor.Union2.Transparency = 1
			local takeoff = game.Workspace.Nuke.Takeoff
			takeoff.Parent = workspace
			takeoff:Play()

			wait(12)
			local takeoffbang = game.Workspace.Nuke.TakeoffBang
			takeoffbang.Parent = workspace
			takeoffbang:Play()

			game.Workspace.Nuke.Missle.PrimaryPart = game.Workspace.Nuke.Missle.Base	
			for i=1,320 do
				game.Workspace.Nuke.Missle:SetPrimaryPartCFrame(game.Workspace.Nuke.Missle:GetPrimaryPartCFrame()+Vector3.new(0,0.05*((1.1^(i/5))/3),0))
				wait()
			end
			wait()
			close:Play()
			game.Workspace.Bunker.BunkerDoor.Door:Play()
			for i=1,100 do
				game.Workspace.Nuke.Missle:SetPrimaryPartCFrame(game.Workspace.Nuke.Missle:GetPrimaryPartCFrame()+Vector3.new(0,0.05*(1.1^((250-i)/5)/3),0))
				game.Workspace.Nuke.Missle:SetPrimaryPartCFrame(game.Workspace.Nuke.Missle:GetPrimaryPartCFrame()*CFrame.Angles(0,math.pi/100,0))
				game.Workspace.Nuke.Missle:SetPrimaryPartCFrame(game.Workspace.Nuke.Missle:GetPrimaryPartCFrame()+Vector3.new(0,0,-i/100))	
				wait()
			end
			wait()
			for i=200,120,-1 do
				game.Workspace.Nuke.Missle:SetPrimaryPartCFrame(game.Workspace.Nuke.Missle:GetPrimaryPartCFrame()-Vector3.new(0,0.1*((1.1^(i/2.95))/4),0))
				wait()
			end
			plr.PlayerGui.NukeWarning.Enabled = false
			game.Workspace.Nuke.Missle.Tip.Transparency = 0.5
			game.Workspace.Nuke.Missle.Tip.CanCollide = false
			game.Workspace.Nuke.Missle.Tip.Mesh.Scale = Vector3.new(1,1,1)
			local boom = game.Workspace.Nuke.Boom
			boom.Parent = workspace
			boom:Play()
			local frame = game.Workspace.Nuke.Missle.Tip.CFrame

			game.Workspace.Nuke.Missle.Tip.kill_script.Disabled = false
			plr.PlayerGui.NukeWarning:Destroy()

			for i=1,400 do
				game.Workspace.Nuke.Missle.Tip.Size=game.Workspace.Nuke.Missle.Tip.Size+Vector3.new(3,3,3)
				game.Workspace.Nuke.Missle.Tip.CFrame=frame
				wait()
			end
			game.Workspace.Nuke.Missle.Tip.kill_script.Disabled=true
			game.Workspace.Nuke.Missle:Destroy()
			siren:Stop()
			boom:Stop()
			wait(5)
			open:Play()
			game.Workspace.Bunker.BunkerDoor.Door:Play()
			game.Workspace["Warhead Control Facility"].NukeTrapdoor.Union.Transparency = 0
			game.Workspace["Warhead Control Facility"].NukeTrapdoor.Union2.Transparency = 0
		end
	end

RemoteEvent.OnClientEvent:Connect(onClientReceive)

:heart: Thank you for your time!

5 Likes

Maybe cause your de-bounce system isn’t working properly so the sound just loops repetitively

1 Like

How can I fix that? I’ve tried sorting it out…

honestly i kind of suck at getting de bounce to work properly but you could try using (BoolValue Instance) maybe sometimes their easier to work with

1 Like

Well it can’t be the debounce because it’s the exact same before it broke and started playing that other sound

I think i figured it out the problem is you have multiple loops in one script. robloxs can only run a single loop unless you use threads

How can I do that? I’m trash at coding

say i have 2 while loops printing different stuff Both wont print only one will print until the other loops yields/stops

I don’t know how to fix that though, is there a way you could provide me a code?

how did you get this code to work in the first place well at least sort off their is no way you know how to use remote event but don’t understand threads… i will provide code Threads are fundamental

1 Like

Sorry, most of the code is from my friend @Roul243, and he’s currently sleeping :sweat_smile:

1 Like

Honestly not even 100% percent Sure if it’s that but i’ll give you links on it anyways. tbh the code is very poorly written and quite messy not that good looking code is essential UnderStanding Threads

1 Like

Okay thanks, that helped me. But now, I can’t find where the multi-thread is. Is there a way you can tell me which piece of code is ‘multi-threaded’

Hi there. Could you check if the sound id is the proper one for each Sound instance in the explorer window?

1 Like

Oopsies, looks like the ID was the same.

im so stupid omg ty for your time @MykoNil and @swag4lifex :heart:
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.