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

Announcer Still Not Working?

Asked by 9 years ago

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?

PersonScreen = game.StarterGui.Screen.PersonScreen
Next = script.NextTime
Trum = script.Trumpets
function OnPlayerEntered(player)
if player.userId == game.CreatorId then
    PersonScreen.Visible = true
    Next.Play()
    wait(7)
    PersonScreen.Visible = false
    wait(8)
    Next.Stop()
else    
if player.userId ==  17776158 then 
    PersonScreen.Text = "ActuallyConnor Joined The Game!"
    PersonScreen.Visible = true
    Trum:play()
    wait(5)
    PersonScreen.Visible = false
    wait(20)
    Trum:stop()
end
end
end

2 answers

Log in to vote
1
Answered by 9 years ago
Next = script.NextTime
Trum = script.Trumpets
function OnPlayerEntered(player)
if player.userId == game.CreatorId then
        for _,v in pairs (game.Players:GetPlayers()) do
            PersonScreen = v:WaitForChild("PlayerGui").Screen.PersonScreen
            PersonScreen.Text = "ActuallyConnor Joined The Game!"
            PersonScreen.Visible = true
        end
    Next:Play()
    wait(7)
        for _,v in pairs (game.Players:GetPlayers()) do
            PersonScreen = v:WaitForChild("PlayerGui").Screen.PersonScreen
            PersonScreen.Visible = false
        end
    wait(8)
    Next:Stop()
else    
if player.userId ==  17776158 then 
        for _,v in pairs (game.Players:GetPlayers()) do
            PersonScreen = v:WaitForChild("PlayerGui").Screen.PersonScreen
            PersonScreen.Text = "ActuallyConnor Joined The Game!"
            PersonScreen.Visible = true
        end
    Trum:play()
    wait(5)
        for _,v in pairs (game.Players:GetPlayers()) do
            PersonScreen = v:WaitForChild("PlayerGui").Screen.PersonScreen
            PersonScreen.Visible = false
        end
    wait(20)
    Trum:stop()
end
end
end

game.Players.PlayerAdded:connect(OnPlayerEntered)

Basically, the for loops get each player in players and changes the gui manually.

0
Didnt Wrok :/ TayLife12 69 — 9y
0
Output? HungryJaffer 1246 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

You need to have the connect function

PersonScreen = game.StarterGui.Screen.PersonScreen
Next = script.NextTime
Trum = script.Trumpets
function OnPlayerEntered(player)
if player.userId == game.CreatorId then
    PersonScreen.Visible = true
    Next.Play()
    wait(7)
    PersonScreen.Visible = false
    wait(8)
    Next.Stop()
else   
if player.userId ==  17776158 then
    PersonScreen.Text = "ActuallyConnor Joined The Game!"
    PersonScreen.Visible = true
    Trum:play()
    wait(5)
    PersonScreen.Visible = false
    wait(20)
    Trum:stop()
end
end
end
game.Players.PlayerAdded:connect(OnPlayerEntered)
0
It Now Says In The Output "attempt to call a nil value" TayLife12 69 — 9y
0
Which line? ADeadlyGuest4 62 — 9y
0
Doesnt tell TayLife12 69 — 9y
0
after the word script it should say the number ADeadlyGuest4 62 — 9y
View all comments (2 more)
0
This is what it says "17:37:01.388 - attempt to call a nil value" TayLife12 69 — 9y
0
Ok Now It Doesn't say it in Studio It was another script, but its still not working in -game. Should I put it in local script? TayLife12 69 — 9y

Answer this question