Insert GUI into all players startergui after timer

Hey there,

For about 45 minutes now, I’ve been trying to make a script that when the timer ends, it will clone a GUI and insert it into everyone’s startergui, being there if you joined after the script worked. So if you were to join after the script inserts it, it’ll be there still. I don’t know how to do this after searching on the web and looking at the devfourm.

Could someone help me out here? Thanks.

1 Like

You could loop through all the players in the game and then clone the gui you want to insert into their PlayerGui.

Something like:

Payers = game:GetService("Players")

for _, player in pairs(Players) do
     local gui = yourGui:Clone() -- Your Gui here
     gui.Parent = player.PlayerGui

I’ll try this out, but where would I put this script/local? Been a few months since I used Studio.

The script is wrong anyways.
This should work

local Players = game:GetService("Players")

for _, Player in pairs(Players:GetPlayers()) do
   local Gui = GuiClone() 
   Gui.Parent = Player.PlayerGui

Some reason didn’t work. Or that I messed something up, *"I changed the (local Gui = Gui:Clone() to local Gui = game.Lighting.Gui:Clone() ) Did I mess this up?

My apologies, just if I did, where would I put my GUI to be cloned into every elses GUI.

Yeah you did. you accidently added “)” Try this.

local Gui = game.Lighting.Gui:Clone()

Didn’t work still, huh… strange. I have no idea :frowning:

Can I see your code?? If you can’t provide us the code we can’t help you.

@Cens_r told you how to add it, place it in StarterGui as well so when a player joins he will have it.

I found the error try this.
We had to use ipairs not pairs.

local Players = game:GetService("Players")

for _, Player in ipairs(Players:GetPlayers()) do
   local Gui = GuiClone() 
   Gui.Parent = Player.PlayerGui

That wouldn’t work he said he wants to insert the gui into all the players after the timer ends.
if you meant cloning the gui to starter gui then it wouldn’t work because it only clones from startergui to playergui when the game starts.

After cloning it to PlayerGUI he should add it to StarterGUI so when a player joins he will have it, that’s what I meant.

Didn’t work, I just cant get it to clone into the StartGUI or PlayerGUI. There’s no errors either.
To specify the gui I did-

local Gui = game.Lighting.StarterGui:Clone() instead of local Gui = Gui:Clone()

as that would make no sense, there’s no specify to the actual gui.

Try doing this instead:

local players = game:GetService("Players")

for _, Player in pairs(players:GetPlayers()) do
   local gui = YourGuiLocation
   gui.Parent = Player.PlayerGui

You dont have to clone the gui. Just put in in StarterGui with it being disabled, then enable it for all players in PlayerGui.

Figured it out with values. Didn’t know.