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!