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

how do i add different sounds to a game?

for example, i wanna add this icy side to my game, and this firey side to my game, but i want it to where once you step from the icy side to the fire side (or vice versa) it plays a different song

2 comments

0

You would Use Filtering Enabled. You would prety much just play the sound on the client side so that one "that" on person can hear the music.

0

so that one person*

1 answer

You could use these two scripts BTW, you will want to make an invisible part around that area you want the music/sound you want it to be in, (Ex. Icy Area)

This script activates when a player touches the invisible part, in this case the player enters the certain area.

Also, add the sounds you want in the startergui.

That's the player entered music script.

script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild('Humanoid') then	
	game.Players[hit.Parent.Name].PlayerGui.Sound1.Volume = 1
	game.Players[hit.Parent.Name].PlayerGui.Sound1:Play() -- Sound1 = the sound 
	print('PlayerHasEntered')
	script.Disabled = true
	script.Parent.Off.Disabled = false
	end
end)

Next is the player exited music script

script.Parent.TouchEnded:Connect(function(hit)
	if hit.Parent:FindFirstChild('Humanoid') then	
	game.Players[hit.Parent.Name].PlayerGui.Sound1.Volume = 0 -- This will silent the music.
	print('PlayerHasExited')
	script.Disabled = true
	script.Parent.On.Disabled = false
	end
end)

Try this.

6 comments

0

wow, thank you for the help! you're a real life saver :D

0

also, what is a startergui? (I'm a relatively new roblox studio-er, but i have 3D modeled on MANY occasions before so i do know quite a bit of things about 3D modeling)

0

oh, no problem also, look up top, then go to 'View>Explorer>(Inside Explorer look down and you'll see startergui)

0

if you're new to studio probably go on youtube and search "Roblox Studio: Basics"

0

thanks! i did!

0

upvote? pls

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