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
how do i add different sounds to a game?
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
wow, thank you for the help! you're a real life saver :D
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)
oh, no problem also, look up top, then go to 'View>Explorer>(Inside Explorer look down and you'll see startergui)
if you're new to studio probably go on youtube and search "Roblox Studio: Basics"
thanks! i did!
upvote? pls
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
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.
so that one person*