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

How do you make it like tanks have firing sounds?

Like for example when i fire it the audio plays then fades.

2 comments

0

I don't know how to do this, however it'd definitely involve something like MouseButton1Click:Connect()

0

The audio needs to be parented to a base part for it to be 3D sound.

1 answer

-- Something like this
-- I would probably make with a click detector

local debounce = false

script.Parent.mouseClick:connect(function()
	if debounce == true then -- keeps people from pressing it constantly
		return
	end
	debounce = true
	local audioID = "rbxassetid://258057783"
	local audio = Instance.new("Sound", game.Workspace)
	audio.SoundId = audioID
	audio:Play()
	for i = 10,0,-1 do -- where it starts fading
		wait(0.3)
		audio.Volume = audio.Volume -0.1
	end
	wait(3)
	audio:Stop()
	audio:Destroy() -- Destroys so it doesn't duplicate over and over everytime you click
	debounce = false
end)

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