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

How do I clone a gui into every ones startergui?

I am trying to make a live event and make it so at the end to it says connection lost and I don't know how to clone a gui into every ones starter gui if someone could help me that would be much appreciated!

1 answer

✓ Accepted answer

You could just place it in the StarterGui at the beginning of the game, but if you want to throw a GUI on all players - that's possible. I'm assuming that you want this GUI to come up upon a specific event, therefore I'll use clicking a button as an example.

You can fire an event to all the clients in-game using the RemoteEvent:FireAllClients() function. Let's say you got a button with a ServerScript inside of a ClickDetector. The script would look like what I have below.

script.Parent.mouseClick:connect(function(plr)
	game.ReplicatedStorage.RemoteEvent:FireAllClients(plr.Name)
end)

The local scripts would have this.

game.ReplicatedStorage.RemoteEvent.OnServerEvent:connect(function(name)
	local GUI = game.Players.LocalPlayer.PlayerGui.ScreenGui:Clone()
	GUI.TextLabel.Text = name.." pressed the button!"
	GUI.Enabled = true
end)

If this helped you out, consider accepting this answer for those sweet, sweet reputation points. If not, comment below and I (or someone else) will help you out.

Be sure to check out the Roblox API Documentation as well for additional reference.

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