Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to put a gui in Every player's PlayerGui with a script?

gui = Instance.new("ScreenGui")
gui.Parent = game.Workspace
frame = Instance.new("Frame")
frame.Parent = gui
frame.Size = UDim2.new(1,0,1,0)
local player = game.Players:GetPlayers()
	    for i = 1, #player do
		gui:Clone()
		gui.Parent = game.Players.player[i].PlayerGui
end

Here is my current code, really beta and the gui's are placeholders currently. What i'm trying to do is clone a gui that I made with this script to all player's playergui (game.Players.Jack_Hase.PlayerGui) not with a localscript. This could be used for a play button when a match is starting or something, any fixes?

1 answer

✓ Accepted answer

Because it's a server script, the gui will appear to everybody else on the server. Basically it's way easier than what you tried to code. You can put it in ServerScriptService or Workspace, doesn't matter.

game.Players.PlayerAdded:Connect(function(player)
	
	local playergui = player:WaitForChild("PlayerGui")
	
	local gui = Instance.new("ScreenGui")
	gui.Parent = playergui
	
	local frame = Instance.new("Frame")
	frame.Parent = gui
	frame.Size = UDim2.new(1,0,1,0)

end)

This discussion is preserved as it was. New answers, comments, and votes are closed.