Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I'm having trouble with playerGUI sounds for cutscenes in my RPG, can someone help?

Asked by 7 years ago

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

end

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?

0
What happens when you change IsPlaying to Playing? harryisbeast 70 — 7y
0
I'll try that ronitrocket 120 — 7y

Answer this question