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

Help With ScreenGui and putting it in all players?

Asked by
Scootakip 299 Moderation Voter
8 years ago
for i, player in ipairs(game.Players:GetChildren()) do
SGGUI = Instance.new("ScreenGui")
SGGUIT = Instance.new("TextBox")
SGGUI.Parent = player.PlayerGui
SGGUIT.Parent = SGGUI

SGGUIT.Text = "Game Starting in 5"
wait(1)
SGGUIT.Text = "Game Starting in 4"
wait(1)
SGGUIT.Text = "Game Starting in 3"
wait(1)
SGGUIT.Text = "Game Starting in 2"
wait(1)
SGGUIT.Text = "Game Starting in 1"
wait(1)
SGGUI:Destroy()
end

This is in a script in Workspace. The script doesn't seem to do anything. Can someone please help me?

2 answers

Log in to vote
1
Answered by 8 years ago
for i, player in ipairs(game.Players:GetChildren()) do
SGGUI = Instance.new("ScreenGui")
SGGUI.Parent = script.Parent:findFirstChild("Script") --Change this to the name of your script
SGGUIT = Instance.new("TextBox")
SGGUIT.Parent = SGGUI
SGGUIT.Size = UDim2.new(.5, 0, .5, 0) --Change this to whatever you want the size to be
SGGUIT.Font = "SourceSansBold" --Change this to whatever you want the font to be
SGGUIT.FontSize = "Size18" --Change this to whatever you want the font size to be
SGGUIT.BackgroundColor3 = Color3.new(0/255, 0/255, 0/255) --Change this to whatever you want the background color to be
SGGUI.Parent = player.PlayerGui

SGGUIT.Text = "Game Starting in 5"
wait(1)
SGGUIT.Text = "Game Starting in 4"
wait(1)
SGGUIT.Text = "Game Starting in 3"
wait(1)
SGGUIT.Text = "Game Starting in 2"
wait(1)
SGGUIT.Text = "Game Starting in 1"
wait(1)
SGGUI:Destroy()
end

Put it in StarterGui. Changing the values also helps it look the way you want it to.

Ad
Log in to vote
0
Answered by 8 years ago
for _, player in pairs(game.Players:GetPlayers()) do -- don't choose randomly between ipairs and pairs. they both have specific purposes. Also use GetPlayers
SGGUI = Instance.new("ScreenGui")
SGGUIT = Instance.new("TextBox")
SGGUI.Parent = player.PlayerGui
SGGUIT.Parent = SGGUI
    spawn(function() -- spawn a function so it doesn't delay the rest of the people getting the gui
        for i = 5,1,-1 do
            SSGUIT.Text = ("Game starting in ".. i .. " seconds.")
            SGGUI:Destroy()
        end
    end)
end

Answer this question