Need help for something

I’ve been wondering how I can do this for a while, I have been wanting to make it where 1 sound plays and then after 2 seconds of that sound, another one plays and I really need help finding out how to do that. Anybody knows how, please reply to this post. Thanks! :slight_smile:

You want it to be done multiple times?

you would need to know the basics of scripting.

Let me give you something

local esto = script --find my script and define it as esto here
script.Parent = workspace --put it in workspace

local sound1 = Instance.new("Sound") --make a new sound
sound1.SoundId = "rbxassetid://246454356" --make the sound id be lovesong for a deadman
--(to get it you need to make a sound inside the game, put the soundid that it gives, copy the asset and set it on that rbxassetid part
sound1.Parent = esto --put the sound as a child of this script

local sound2 = Instance.new("Sound") --make another sound
sound2.SoundId = "rbxassetid://208583799" --make the sound id be you are a pirate
sound2.Parent = esto --put the sound as a child of this script

wait(6) --wait 6 seconds
print("sound1 is playing") --write "sound1 is playing" on the script output 
--(if you don't have the output on you won't see anything, it appears when touch f9 in game
sound1:Play() --play sound1
wait(2) --wait 2 seconds
sound1:Stop() --stop sound1
sound2:Play() --play the next sound
wait(2) --wait 2 seconds
sound2:Stop() --stop it too
sound1:Play() --play the previous one
sound1.Volume = 0.2 --set the volume to 20%

just put this inside a script on the workspace and run the game

1 Like

Thanks, this really helps as I needed this to make a jet that can fire and have a after brrt sound at the end. :slight_smile: Thanks!

Oh, in that case remove the sound1:Stop() and let the machinegun rotation sound play, unless that you’re utilizing two sounds separately on which one of them has both the machine gun rotation sound and the firing sound.

Also, it’s very fun to play dogfights with a controller. If you have controller support it would be really good, keyboard and mouse are a mess for this.

1 Like

I really like this, thank you.

Is it possible to play it off a part? so basically (fire) , then (brrt)?

What type of button input are you using? it should be contextactionservice.

to play it off a part, change the parent from workspace to the part you want.

I changed the script.parent, from workspace to the part you want. Also added the contextactionservice of how I would play it

local esto = script --find my script and define it as esto here
script.Parent = script.Parent.Part --put it in the part you want, used to be workspace

local sound1 = Instance.new("Sound") --make a new sound
sound1.SoundId = "rbxassetid://246454356" --make the sound id be lovesong for a deadman
--(to get it you need to make a sound inside the game, put the soundid that it gives, copy the asset and set it on that rbxassetid part
sound1.Parent = esto --put the sound as a child of this script

local sound2 = Instance.new("Sound") --make another sound
sound2.SoundId = "rbxassetid://208583799" --make the sound id be you are a pirate
sound2.Parent = esto --put the sound as a child of this script

local firing = false --check if it's firing

CAS:BindAction("fire", function(inputname, inputstate, inputobject)
	if inputstate == Enum.UserInputState.Begin then
		sound1:Play()
		firing = true
		
		wait(2)
		if firing then
			sound1:Stop() --YOU STOP THE SOUND ONLY IF THERE'S NO USE TO IT
			sound2:Play() --you play the next sound
			firingeventtoserver:Fire() --you fire the event you should be using to mark that it is indeed firing, 
				--and so it shoots in the server
		end
	else firing = false end
end, false, Enum.UserInputType.MouseButton1)

I’ll try this, I personally don’t know alot about scripting, but this helps. Thank you very much.

There’s three types of input that I know of.

:GetMouse() (which I don’t recommend because it is deprecated),
UserInputType, which is often used for checking what type of input was put, but people use it sometimes to set actions to keys for universal actions (again, I don’t recommend, it’s not useful in that case)
and ContextActionService, which serves an action in a context, meaning that something can be happening at some point and the keys used there are not the same as other ones (I absolutely recommend you use this one, as it seems designed to be used for key input)

If you feel you lack on scripting, I would recommend you what many people recommend when learning scripting: check thedevking’s tutorials on scripting. It’s a very casual introduction to scripting and you’ll start to get an idea of what to do here. He’s not a master on scripting, but he gives a very good introduction to scripting, he doesn’t like giving game support to mobile or controller though, so, there’s that.

1 Like