I am working on a class system where people can pick their gear based on their rank to the group, I have figured out the group and rank selection, however I am having trouble with welding these custom hats onto the dummy model to display the gear they are choosing.
below is the code and a video of my current system along with a picture of the hat model.
code:
if Enlisted == true then
Frame.Div4.Image = "rbxassetid://10631497747"
if Frame.Div4.DeployTag.Text == "Standard" then
print("Enlisted Standard") --button/image editing
--where the welding begins
if game.Workspace.DeploySystem.Dummy:findFirstChild("Hat") ~= nil then
else
local exd = game:WaitForChild("ReplicatedStorage").DeploySystem2.ArmyGroup.Redarmyman
local g = exd.Hat:clone()
g.Parent = game.Workspace
g.Parent = game.Workspace.DeploySystem.Dummy
g.qPerfectionWeld.Disabled = false
local C = g:GetChildren()
for i=1, #C do
if C[i].Name == "qPerfectionWeld" then
else
local W = Instance.new("Weld")
W.Part0 = g.Middle
W.Part1 = g.Middle
local CJ = CFrame.new(g.Middle.Position)
local C0 = g.Middle.CFrame:inverse()*CJ
local C1 = C[i].CFrame:inverse()*CJ
W.C0 = C0
W.C1 = C1
W.Parent = g.Middle
g.Middle.Transparency = 1
local Y = Instance.new("Weld")
Y.Part0 = Dummy.Head
Y.Part1 = g.Middle
Y.C0 = CFrame.new(0, 0, 0)
Y.Parent = Y.Part0
g.Middle.Anchored = false
g.Middle.CanCollide = false
end
end
end
end
end