I am trying to create a script that when a certain person enters the game an Audio and a GUI Pops up... For some reason it wont work! There is no error in script or output. So what do I do?
01 | PersonScreen = game.StarterGui.Screen.PersonScreen |
02 | Next = script.NextTime |
03 | Trum = script.Trumpets |
04 | function OnPlayerEntered(player) |
05 | if player.userId = = game.CreatorId then |
06 | PersonScreen.Visible = true |
07 | Next.Play() |
08 | wait( 7 ) |
09 | PersonScreen.Visible = false |
10 | wait( 8 ) |
11 | Next.Stop() |
12 | else |
13 | if player.userId = = 17776158 then |
14 | PersonScreen.Text = "ActuallyConnor Joined The Game!" |
15 | PersonScreen.Visible = true |
01 | Next = script.NextTime |
02 | Trum = script.Trumpets |
03 | function OnPlayerEntered(player) |
04 | if player.userId = = game.CreatorId then |
05 | for _,v in pairs (game.Players:GetPlayers()) do |
06 | PersonScreen = v:WaitForChild( "PlayerGui" ).Screen.PersonScreen |
07 | PersonScreen.Text = "ActuallyConnor Joined The Game!" |
08 | PersonScreen.Visible = true |
09 | end |
10 | Next:Play() |
11 | wait( 7 ) |
12 | for _,v in pairs (game.Players:GetPlayers()) do |
13 | PersonScreen = v:WaitForChild( "PlayerGui" ).Screen.PersonScreen |
14 | PersonScreen.Visible = false |
15 | end |
Basically, the for loops get each player in players and changes the gui manually.
You need to have the connect function
01 | PersonScreen = game.StarterGui.Screen.PersonScreen |
02 | Next = script.NextTime |
03 | Trum = script.Trumpets |
04 | function OnPlayerEntered(player) |
05 | if player.userId = = game.CreatorId then |
06 | PersonScreen.Visible = true |
07 | Next.Play() |
08 | wait( 7 ) |
09 | PersonScreen.Visible = false |
10 | wait( 8 ) |
11 | Next.Stop() |
12 | else |
13 | if player.userId = = 17776158 then |
14 | PersonScreen.Text = "ActuallyConnor Joined The Game!" |
15 | PersonScreen.Visible = true |