So I was making an RPG, and I was trying to make a sound play in a cutscene I made that plays when you join the game. So I put two sounds in the StarterGUI, one is the music, and one is music for the cutscene. I inserted a localscript into the StarterGUI, and I put this EXACT code into it.
local Players = game:GetService("Players")
function onPlayerAdded(player) game.Players.LocalPlayer.PlayerGUI.Sound.IsPlaying = true game.Players.LocalPlayer.PlayerGUI.MainMusic.IsPlaying = false wait(19) game.Players.LocalPlayer.PlayerGUI.MainMusic.IsPlaying = true game.Players.LocalPlayer.PlayerGUI.Sound.IsPlaying = false
The reason the wait time is 19 is 'cause the cutscene is that long.
So I was hoping that when a player joins, it would stop the main music and play the cutscene music. The cutscene music is on by default, and the Main Music is off by default.
So I got that part, but I don't think the second part of the script works, it just continues playing the cutscene music forever.
Can someone give me the script and explain it as well, so I can use it in my game quickly but be able to do it myself next time?