Hey DevForum, I’ve been stumped on something for a while.
I’m making a script where you can toggle hair and transformations through keybinds, but when I add the hair the player movement starts getting wonky. The hair mesh is massless and CanCollide is turned off, and is welded to the head. The problem persists after the mesh along with the weld is removed. Here’s an example:
local user = game.Players.LocalPlayer
local root = user.Character.PrimaryPart
root.Name = "valid"
local accessories = user.Character:GetDescendants()
for i,v in pairs(accessories) do
if v:IsA("Accessory") then
v.Handle.Transparency = 1
end
end
local hair = game:GetService("ReplicatedStorage").goku:Clone()
local head = user.Character.Head
head.Size = Vector3.new(1,1,1)
hair.Parent = head
hair.Massless = true
hair.CanCollide = false
local weld = Instance.new("Weld",hair)
weld.Part0 = head
weld.Part1 = hair
weld.C0 = CFrame.Angles(0,math.rad(90),0) * CFrame.new(-.55,1,-.05)
end
local user = game.Players.LocalPlayer
local root = user.Character.PrimaryPart
root.Name = "invalid"
local accessories = user.Character:GetDescendants()
for i,v in pairs(accessories) do
if v:IsA("Accessory") then
v.Handle.Transparency = 0
end
end
local hair = user.Character.Head.goku
hair:Destroy()
end