Too much Image Labels

Hello,

I am making a User Check game, and I have added a feature that checks the player’s outfits. Works fine, but problem is, it creates so many stuff in the frame, as shown in this video:

I tried to fix this by putting the loop in the function itself but this happens:


Only one outfit appears.
Here’s the snippets of codes involved in this:

                local outfitEvent = game:GetService("ReplicatedStorage"):WaitForChild("OutFitEvent")
				local outFitTable = outfitEvent:InvokeServer(UserInfo.Id)
				print(outFitTable)
				local outFitNames = outFitTable[2]	
				local outFitIds = outFitTable[1]
				createOutfitInfo(outFitNames,outFitIds)

The Server:

game:GetService("ReplicatedStorage"):WaitForChild("OutFitEvent").OnServerInvoke = function(plr,id)
	local players = game:GetService("Players")
	local outfits,outfitNames = getUserOutfits(id)
	local outFitIdNewTable = {}
	for _,outFitId in pairs(outfits) do
		--task.wait(DELAY_TIME)
--		local outFitDesc = players:GetHumanoidDescriptionFromOutfitId(outFitId)
		--local R6orR15 = outFitDesc.playerAvatarType
		--[[local hMD = players:CreateHumanoidModelFromDescription(outFitDesc,Enum.HumanoidRigType.R6)
		hMD.Parent = workspace
		hMD.Name = outfitNames]]
		table.insert(outFitIdNewTable,outFitId)
	end
	return {outFitIdNewTable,outfitNames}
end

The Function In The Client:

local function createOutfitInfo(name,id)
	local outFitImage = Instance.new("ImageLabel",outfitsBackgrounds)
	for _, i in ipairs(id) do
		outFitImage.Image = "rbxthumb://type=Outfit&id=" .. i .. "&w=420&h=420"
	end
	outFitImage.BackgroundTransparency = 1
	local nameTextLabel = Instance.new("TextLabel",outFitImage)
	nameTextLabel.TextColor3 = Color3.fromRGB(225,225,225)
	nameTextLabel.Position = UDim2.new(-0.3,0,1,0)
	nameTextLabel.Size = UDim2.new(0,99,0,33)
	nameTextLabel.TextScaled = true
	for _, n in ipairs(name) do
		nameTextLabel.Text = n
		nameTextLabel.Name = n
	end
	nameTextLabel.FontFace.Bold = true
	nameTextLabel.BackgroundTransparency = 1
	local spawnButton = Instance.new("TextButton",outFitImage)
	spawnButton.Size = UDim2.new(0,100,0,23)
	spawnButton.Position = UDim2.new(0,0,0.61,0)
	spawnButton.TextScaled = true
	spawnButton.TextColor3 = Color3.fromRGB(238,238,238)
	spawnButton.BackgroundColor3 = Color3.fromRGB(51,152,0)
	spawnButton.Text = "Spawn Outfit"
	spawnButton.FontFace.Bold = true
	spawnButton.Visible = false
	outFitImage.InputBegan:Connect(function(inp)
		if inp.UserInputType == Enum.UserInputType.MouseButton1 then
			spawnButton.Visible = not spawnButton.Visible
		end
	end)
end

Help is appreciated!

Still wondering what could cause this… I updated my code and it results in the same thing as video #1:

local function createOutfitInfo(name,id)
	outfitCheckTimes += 1
	for _, i in ipairs(id) do
		for _, n in ipairs(name) do
			local outFitImage = Instance.new("ImageLabel",outfitsBackgrounds)
			outFitImage.Image = "rbxthumb://type=Outfit&id=" .. i .. "&w=420&h=420"
			outFitImage.BackgroundTransparency = 1
			local nameTextLabel = Instance.new("TextLabel",outFitImage)
			nameTextLabel.TextColor3 = Color3.fromRGB(225,225,225)
			nameTextLabel.Position = UDim2.new(-0.3,0,1,0)
			nameTextLabel.Size = UDim2.new(0,99,0,33)
			nameTextLabel.TextScaled = true
			nameTextLabel.Text = n
			nameTextLabel.Name = n
-----------------------------------------------------------------------------------------------------------------------
			nameTextLabel.FontFace.Bold = true
			nameTextLabel.BackgroundTransparency = 1
			local spawnButton = Instance.new("TextButton",outFitImage)
			spawnButton.Size = UDim2.new(0,100,0,23)
			spawnButton.Position = UDim2.new(0,0,0.61,0)
			spawnButton.TextScaled = true
			spawnButton.TextColor3 = Color3.fromRGB(238,238,238)
			spawnButton.BackgroundColor3 = Color3.fromRGB(51,152,0)
			spawnButton.Text = "Spawn Outfit"
			spawnButton.FontFace.Bold = true
			spawnButton.Visible = false
			outFitImage.InputBegan:Connect(function(inp)
				if inp.UserInputType == Enum.UserInputType.MouseButton1 then
					spawnButton.Visible = not spawnButton.Visible
				end
			end)
		end
	end
	if outfitCheckTimes > 1 then
		clearOutfits()
	end
end

It might be something to do with the loops, any help with it would be appreciated

Unless I’m just missing it somewhere, what does your getUserOutfits() function look like? Issue might be in there.

1 Like

Agreed, we need to see what is in this function. My guess is the same as @drumzart, it is probably all happening there.

No, already solved this issue. Definitely not the issue with the function.

Well, I’m happy you solved it yourself.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.