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

My gui will only show for one player, why is that?

Asked by 10 years ago

I want this gui to show for all players, for some reason it is only showing on one players screen. My guess is that it is something to do with the variables being reassigned before the script has a chance to run through or something like that?

**UPDATED SCRIPT THANKS TO HELP FROM chararray256 **

function mem(v)
    print(1)
    coroutine.wrap(function()   
        print(2)
        repeat wait() print("waiting") until v:FindFirstChild("PlayerGui")
        gui = v:FindFirstChild("PlayerGui").Loading.d
        print(3)
        wait()
        gui.Image = "http://www.roblox.com/asset/?id=154661376"
        gui.Visible = true
        print(4)
        for i = 1,10 do
            for a,b in pairs(introGuis) do
                print("try")
                gui.Image = "http://www.roblox.com/asset/?id=" .. b
                wait(.1)
            end
        end
        gui.Visible = false
    end)()  
end 
for i,v in pairs(game.Players:GetPlayers()) do mem(v)end    

3 answers

Log in to vote
1
Answered by
gskw 1046 Moderation Voter
10 years ago

Try this:

function GiveGui(v)
    print(1)
    coroutine.wrap(function()   
        print(2)
        repeat wait() print("waiting") until v:FindFirstChild("PlayerGui")
        gui = v:FindFirstChild("PlayerGui").Loading.d
        print(3)
        wait()
        gui.Image = "http://www.roblox.com/asset/?id=154661376"
        gui.Visible = true
        print(4)
        for i = 1,10 do
            for a,b in pairs(introGuis) do
                print("try")
                gui.Image = "http://www.roblox.com/asset/?id=" .. b
                wait(.1)
            end
        end
        wait(5)
        gui.Visible = false
    end)()  
end
for i,v in pairs(game.Players:GetPlayers() do GiveGui(v) end
game.Players.PlayerAdded:connect(GiveGui)

Your script didn't work because it was ran only once, when the server was started.

0
This isn't the full script, it is midway down the real script. And how will making it a function help, out of curiosity (could you explain your change) crackabottle123 110 — 10y
0
I made the function connected to the PlayerAdded event. I made it a function to not have to write it twice (in the for loop and the connect() method.) gskw 1046 — 10y
0
Thankyou for your answer, but one last question . Why is the playeradded there in the first place? Is it really necessary (I dont want it run on playeradded, just to all players at a certain time which is done using the for loop you provided) crackabottle123 110 — 10y
0
It is neccessary as the for loop runs only once, when the server is started. I made it work so a player gets the GUI when they join as it seems you want it to work so. gskw 1046 — 10y
View all comments (3 more)
0
Still does not work, I put my co-routine into a function then called it with a for loop using "v" as the argument, that way the function ran for each person BUT still only one person received the GUI crackabottle123 110 — 10y
0
If it is in a LocalScript, put it in a regular script. gskw 1046 — 10y
0
Sorry! It works! Thankyou so much! crackabottle123 110 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

I read somewhere that "if it's placed in a PlayerGui then it will display to one person but if it's placed in workspace then it will display to everyone

0
But I am accessing everyones playergui, for that exact reason. crackabottle123 110 — 10y
Log in to vote
0
Answered by 10 years ago

Just make the actual Gui and put it in Starter Gui.

Answer this question