Working with clones

Hi,

So I got a query with clones which is bugging me.

Above is a screenshot with what I am working with, so I understand how to work with clones and how to call it. However, I can not wrap my head around working with changing the properties. So I want to change the textlabel “Name” to the player who joins. If someone from this generous community can explain how I can call this textlabel and work with its properties that’ll be greatly appreciated.

Your issue here is probably due to the fact that you have the TextLabel “named” Name. This is causing interference with the “Name” property of the ScrollingFrame. I would advise you change the TextLabel in ScrollingFrame called “Name” to something like playerName.

1 Like

Just changed that now, however my question is how I can call this “playerName” component in this script in order to work with its properties?

local Players = game:GetService("Players")
local frame = script.Parent
local function create_player_gui(plr)
	if frame:FindFirstChild(plr.Name) then return end
	print("Making Gui for "..plr.Name)
	local copy = frame:Clone()
	name.Text = plr.Name
	name.Name = plr.Name
	name.Parent = frame


end

Players.PlayerAdded:Connect(function(plr)
	create_player_gui(plr)
end)
Players.PlayerRemoving:Connect(function(plr)
	create_player_gui(plr)
end)

Are you trying to create a new scrollingframe, or a new characterpick for each player?

1 Like

I’ll be cloning the character pick for each player.

You can access children of an Instance with .

local copy = frame:Clone()

-- index ScrollingFrame inside of cloned CharacterPick
local scrollingFrame = copy.ScrollingFrame

-- index avatar, name, and status labels inside of ScrollingFrame
local Avatar = scrollingFrame.Avatar
local Name = scrollingFrame.playerName
local Status = scrollingFrame.Status

-- set properties of the indexed labels
Name.Text = plr.Name
Name.Name = plr.Name
-- etc