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

How does Clone() work?

I'm not the sharpest knife in the drawer when it comes to this. I got a gui in lighting and i want it to clone into a players playergui when the join my place.

local Player	= game.Players.LocalPlayer
local gui		= game.Lighting["GUI"]

function OnEnter(player)
	
end

Player.PlayerAdded:connect(OnEnter)

1 answer

✓ Accepted answer

:clone() does what its name says! It copies the object, and places it wherever you choose it to. For example, if you want it to clone a GUI into a Player's PlayerGui when they first join, you wouldn't need to use LocalPlayer. You can have it as a normal script in Workspace.

gui = game.Lighting["GUI"] -- doesn't need to be local

game.Players.PlayerAdded:connect(function(player)
	gui:clone().Parent = player.PlayerGui
end)

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