Trying to clone textbuttons according to how many accessories a player has

im trying to clone text buttons to a scrolling frame according to how many accessories the player has.
eg: plr has 3 accessories β†’ clone 3 buttons to scrolling frame


image

local script:

local char = script.Parent
local accessoryEvent = game.ReplicatedStorage.accessoryEvent

for i, accessory in pairs(char:GetChildren()) do
	if accessory:IsA("Accessory") then
		print(accessory.Name)
		
	end
	
	accessoryEvent:FireServer(accessory)
end

script:

local accessoryEvent = game.ReplicatedStorage.accessoryEvent
local sf = script.Parent

accessoryEvent.OnServerEvent:Connect(function(p, accessory)
	
	for i = 1, #accessory do
		local slot = game.ReplicatedStorage.accessorySlot
		local slotClone = slot:Clone()
		slotClone.Parent = sf
	end
end)

The accessory value is an instance. You’re firing this remote for every accessory the player has. Instead, you should let the client figure out your accessories, and the client will also make all the buttons. It’s frowned upon to create UI on the server!

2 Likes

ohh mb mb :man_facepalming: i shouldve known yeah. it was an off day icl. tysm man! :smiley: