I’m making a fighting game that has many characters. I setup a gui menu that creates multiple image buttons with an icon that the character has. When you press on the button once it should show a randomly posed rig that is wearing the same outfit as the character chosen. The problem is that it only shows the clothing but not the accessories. I haven’t noticed any problems with the rig nor the accessories so i assume it has something to do with the code i used to put the outfit on the rig. I’ve looked around for other people with the same issue but none of it is the same problem im having.
Gui code:
local Frame = script.Parent
Frame.Parent.Enabled = true
local CharacterPreview = Frame.CharacterPreview
local CharacterList = Frame.CharacterList
local AbilitiesFrame = Frame.AbilitiesFrame
local cam = Instance.new("Camera")
cam.Parent = CharacterPreview
CharacterPreview.CurrentCamera = cam
cam.CFrame = CFrame.new(Vector3.new(0, 2, -3.5), Vector3.zero)
local SpawnEvent = script.SpawnEvent
local ReplicatedStorage = game.ReplicatedStorage
local Characters = ReplicatedStorage.Characters
local PosedRigs = ReplicatedStorage.PosedRigs:GetChildren()
local SelectedCharacter = nil
for i, Character in pairs(Characters:GetChildren()) do
local IconButton = Instance.new("ImageButton", CharacterList)
IconButton.Name = Character.Name
IconButton.Image = Character.Icon.Texture
IconButton.MouseButton1Click:Connect(function()
if SelectedCharacter == Character.Name then
SpawnEvent:FireServer(Character)
Frame.Parent.Enabled = false
else
for i, v in pairs(CharacterPreview:GetChildren()) do
v:Destroy()
end
print(#PosedRigs)
local PosedRig = PosedRigs[math.random(1, #PosedRigs)]:Clone()
PosedRig.Parent = CharacterPreview
PosedRig:PivotTo(CFrame.new())
for i, v in pairs(Character.Outfit:GetChildren()) do
v:Clone().Parent = PosedRig
end
CharacterPreview.BackgroundColor3 = Color3.new(math.random(.5, 1), math.random(.5, 1), math.random(.75, 1))
SelectedCharacter = Character.Name
end
end)
end
Characters Folder:
edit: earlier the buttons showed up but now they dont even. So i have two problems now
edit 2: Made the buttons show up again, just named something wrong in the editor. but the rigs still dont have the accessories.
Rig:
He should have hat, gotee, and glasses