I am new to scripting and editing GUIs and I am trying to learn more about sounds, I would really appreciate it if you answered
Make a part in the entrance to the room with a script in it, that clones the music into the Player's PlayerGui. You need to use :GetPlayerFromCharacter(), eg.
01 | script.Parent.Touched:connect( function (p) |
02 | local music = --whatever:Clone() |
03 | if p.Parent:FindFirstChild( "Humanoid" ) then |
04 | local player = game.Players:GetPlayerFromCharacter(p.Parent) |
05 | if player then |
06 | if player.PlayerGui.Music then |
07 | print ( "Music all ready" ) |
08 | elseif player.PlayerGui.Music = = nil then |
09 | music.Parent = player.PlayerGui |
10 | music.Name = "Music" |
11 | music:Play() |
12 | end |
13 | end |
14 | end |
15 | end ) |
If this helps, accept the answer. It gives us both rep!
You would probably have to put the music in the LocalPlayer is my guess