I'm trying to make a brick part of the character appearance, but it rotates differently everytime I trigger the script. How do I get it to not rotate differently everytime I trigger the touch event?
script.Parent.Touched:Connect(function(hit)
local newPart = game.ServerStorage.Hazmat.HazmatMask:Clone()
if hit.Parent:FindFirstChild("Humanoid") then
if hit.Parent:FindFirstChild("HazmatMask") then
else
newPart.Parent = hit.Parent
newPart.CFrame = CFrame.new(hit.Parent:FindFirstChild("Head").Position)
local weld = Instance.new("ManualWeld")
weld.Part0 = newPart
weld.Part1 = hit.Parent:FindFirstChild("Head")
weld.C0 = newPart.CFrame:inverse() * hit.Parent:FindFirstChild("Head").CFrame
weld.Parent = hit.Parent:FindFirstChild("Head")
end
end
end)

10 comments
It doesn't rotate anymore, but it positions itself differently now. Depanding on where I touch the part.
I have checked the code with random mask from library, it works. Weird. Maybe your HazmatMask model is bad.
It doesn't do this till I add to the Vector3 value.
I may be overcomplicating things. Is your HazmatMask made of a single part with mesh?
No, It's a union, could that be the reason it's not working?
Alright, I tested it with a normal part and it works. So I guess it is because of it being a union.
Is there a way it could work with a union?
Sorry, i don't know. I am not really using the unions. Try creating invisible, non collidable block in the middle and weld the union to it. Then make a union as a child of this part, and CFrame only this part.
Smart thinking, I'll try it.
Thanks a lot with helping, I did what you did but with a head. So I wouldn't have to change the vector value.