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

why won't my script create a screengui in the players PlayerGui?

Asked by
Prioxis 673 Moderation Voter
10 years ago

I made a script that creates a screengui with a frame in it and then also in the screengui is a textlabel and i'm using game.Players.PlayerAdded:connect(function(plr)

heres my script

game.Players.PlayerAdded:connect(function(plr)
local gui = Instance.new("ScreenGui", plr.PlayerGui)
    gui.Name = "Main"
    wait(1)
    local frame = Instance.new("Frame", gui)
    wait(1)
    local Text = Instance.new("TextLabel", gui)
    Text.Name = "Load"
    wait(1)
while wait(5) do
    plr.PlayerGui.Main.Load.Visible = true
    wait(0.1)
    plr.PlayerGui.Main.Load.Text = "[Loading] 7%"
    wait(0.5)
        plr.PlayerGui.Main.Load.Text = "[Loading] 13%"
    wait(0.3)
        plr.PlayerGui.Main.Load.Text = "[Loading] 20%"
    wait(0.5)
    plr.PlayerGui.Main.Load.Text = "[Loading 27%"
    wait(0.3)
    plr.PlayerGui.Main.Load.Text = "[Loading] 33%"
    wait(0.5)
    plr.PlayerGui.Main.Load.Text = "[Loading] 40%"
    wait(0.3)
        plr.PlayerGui.Main.Load.Text = "[Loading] 47%"
    wait(0.5)
    plr.PlayerGui.Main.Load.Text = "[Loading] 53%"
    wait(0.3)
    plr.PlayerGui.Main.Load.Text = "[Loading] 60%"
    wait(0.5)
        plr.PlayerGui.Main.Load.Text = "[Loading] 67%"
    wait(0.3)
        plr.PlayerGui.Main.Load.Text = "[Loading] 74%"
    wait(0.5)
    plr.PlayerGui.Main.Load.Text = "[Loading] 83%"
    wait(0.3)
        plr.PlayerGui.Main.Load.Text = "[Loading] 95%"
    wait(0.5)
    plr.PlayerGui.Main.Load.Text = "[Loading] 100%"
    wait(0.3)
    plr.PlayerGui.Main.Load.Text = "Loading Complete!"
    wait(0.5)
        plr.PlayerGui.Main.Load.BackgroundTransparency = 0.2
    wait(0.1)
        plr.PlayerGui.Main.Load.BackgroundTransparency = 0.4
    wait(0.1)
        plr.PlayerGui.Main.Load.BackgroundTransparency = 0.6
    wait(0.1)
    plr.PlayerGui.Main.Load.BackgroundTransparency = 0.8
    wait(0.1)
        plr.PlayerGui.Main.Load.BackgroundTransparency = 1
    wait(0.1)
        plr.PlayerGui.Main.Load.Text = ""
    wait(0.1)
    plr.PlayerGui.Main.Load:remove()
    wait(0.1)
    plr.PlayerGui.Main.Frame.Visible = true
end
end)

0
Are you sure you want to loop your Loading Gui? It will just reply over and over again, you should probably put it into a function. SlickPwner 534 — 10y
0
oh okay thank you that might help Prioxis 673 — 10y
0
It is still not working nothing is inserted into the players playergui Prioxis 673 — 10y

1 answer

Log in to vote
2
Answered by
Link43758 175
10 years ago

The answer is simple: PlayerGui hasn't loaded yet. You're better off putting this in a local script, or adding plr:WaitForChild("PlayerGui") after game.Players.PlayerAdded:connect(function(plr)

0
still doesn't work Prioxis 673 — 10y
Ad

Answer this question