local hat = script.Parent hat.PrimaryPart = hat:WaitForChild("Head") -- Make sure the Head is the same size as a normal Head.

function weldParts(part0, part1) -- welds the 2 parts based on their position local newWeld = Instance.new("Weld") newWeld.Part0 = part0 newWeld.Part1 = part1 newWeld.C0 = CFrame.new() newWeld.C1 = part1.CFrame:toObjectSpace(part0.CFrame) newWeld.Parent = part0 end

hat.Head.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") and not hit.Parent:FindFirstChild("Earl's Coronet")then else return end

local head = hit.Parent:FindFirstChild("Head")
local newHat = hat:Clone()
newHat:FindFirstChild("HatScript"):Destroy()
newHat:SetPrimaryPartCFrame(head.CFrame) -- puts the head into the head
newHat.PrimaryPart:Destroy()
for _, part in pairs (newHat:GetChildren()) do
	if part:IsA("BasePart") then
		weldParts(head, part)
		part.CanCollide = false
		part.Anchored = false
	end
end
newHat.Parent = hit.Parent

end)

3 comments

0

If you know how to fix it post full fixed thing so I can copy and paste I am a noob so yeah if you tell me what is wrong instead of fixing it I will have no clue ho to fix it

0

Is does the hat have any attachments in it?

0

Like what like parts