Accessory Display Issues

I have a vest display, when you step on the head part it clones the vest and applies it to your character, but the main vest display does not anchor and falls to the ground, if you anchor it, when you put on the vest it will bring your character inside of the display

How can I make it to where the display is anchored, and once put on it doesn’t pin you inside of the display?

Explorer:
Model

  • Vest
  • Head
    (What is inside of the model itself ^)
2 Likes

Make the vest anchored and put a script inside of the model:

Now I’m assuming the Vest is a accessory.

(Didn’t test just what I thought of)

local Players = game:GetService("Players")

local Model = script.Parent
local Head = Model:WaitForChild("Head", 1)
local Vest = Model:WaitForChild("Vest", 1) --> Assuming this is an accessory.

Head.Touched:Connect(function(hit)
	local Character = hit.Parent
	
	if (not Character:IsA("Model")) or (not Players:GetPlayerFromCharacter(Character)) then return end
	
	local Humanoid: Humanoid = Character:FindFirstChild("Humanoid")
	if not Humanoid then return end
	
	if Character:FindFirstChild(Vest.Name) then return end
	
	local CloneVest = Vest:Clone()
	
	for _, v in pairs(CloneVest:GetDescendants()) do
		if v:IsA("MeshPart") or v:IsA("BasePart") then
			v.Anchored = false
		end
	end
	
	Humanoid:AddAccessory(CloneVest)
end)
2 Likes

Oh no it is not an accessory my apologies, it is more of a model, this did not seem to work it still brought me into the display vest unfortunately!

1 Like

I would recommend having a display vest that you anchor and a source vest you clone from that is unanchored, and stored somewhere like ReplicatedStorage.

After unanchoring the source model, weld it together. I would recommend using RigEdit to weld it.

Second, when the player equips the vest, you would weld the main part of the vest (the part to which you welded all the other parts in the vest) to the character’s torso.

Let me know if you need an extensive explanation.

1 Like

Here is the script within the model itself, I am attempting to make it work, I could show you the script that isn’t working.

function onTouched(hit)
	if hit.Parent:findFirstChild("Humanoid") ~= nil and hit.Parent:findFirstChild("Vest") == nil then
		local g = script.Parent.Parent.Vest:clone()
		g.Parent = hit.Parent
		local C = g:GetChildren()
		for i=1, #C do
			if C[i].className == "Part" or C[i].className == "UnionOperation" or C[i].className == "MeshPart" then
				local W = Instance.new("Weld")
				W.Part0 = g.Middle
				W.Part1 = C[i]
				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
			end
				local Y = Instance.new("Weld")
				Y.Part0 = hit.Parent.Torso
				Y.Part1 = g.Middle
				Y.C0 = CFrame.new(0, 0, 0)
				Y.Parent = Y.Part0
		end

		local h = g:GetChildren()
		for i = 1, # h do
			h[i].Anchored = false
			h[i].CanCollide = false
		end
		
	end
end

script.Parent.Touched:connect(onTouched)
1 Like