Accessories not working on rig

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:
image

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:
image
He should have hat, gotee, and glasses

1 Like

you could try welding the accessories.
if that doesn’t work, you could manually set the positions (example: Accessory.Handle.Position = Head.Position+Vector3.new(0,.5,0) )
you could also set the rotation based off the head’s rotation.

if that isnt getting the results you want, you could try doing Accessory.Handle.CFrame = Head.CFrame + (Head.CFrame.UpVector * 1) and adjust the “1” until it works?

(im unable to test these but they could work)

Does your rig have the necessary attachments to place the accessories on? According to my understanding, they automatically fit on the character if the attachment is there, correct me if wrong.

I checked and they have the right attachments. Im wondering if the fact its in a viewport frame that that’s doing something. When i check the accessories they are parented to the rig correctly too. Also the player equips the outfit correctly.

I’ll see if welding works i guess.

So i tried welding and it does attach them, but apparently it was always attached. the viewport frame just isnt showing the accessories. If i take the rig out of the viewport frame and into the workspace it shows the accessories, and when i put it back into the viewport it shows the accessories. So no idea what i should do

Fixed it! i had to weld the accessories to the rig and put the rig in a worldmodel parented to the viewport!

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