Why Isn't my Morphed Character Moving?
I have created a few morphs for my game. When I morph my character to something else, this is how I do it:
01 | local function removeAccessories(char) |
02 | for i,v in pairs (char:GetDescendants()) do |
03 | if v:IsA( "Accessory" ) or v:IsA( "Hat" ) or v:IsA( "Decal" ) or v:IsA( "ShirtGraphic" ) then |
09 | local function removeBody(char) |
10 | for i,v in pairs (char:GetDescendants()) do |
11 | if v:IsA( "BasePart" ) or v:IsA( "UnionOperation" ) or v:IsA( "MeshPart" ) then |
18 | local function weld(a, b) |
19 | local w = Instance.new( "ManualWeld" , a) |
20 | w.Name = a.Name.. "_Weld_" ..b.Name |
21 | w.C 0 = a.CFrame:inverse() * b.CFrame |
26 | game.ReplicatedStorage.MorphEvent.OnServerEvent:Connect( function (plr, morph) |
27 | local clone = morph:Clone() |
28 | local char = plr.Character |
31 | removeAccessories(char) |
34 | local pos = clone.Torso.Position |
35 | clone.Torso.CFrame = char.Torso.CFrame - Vector 3. new( 0 , (char.Torso.Position.Y - pos.Y) * 2 , 0 ) |
36 | weld(char.Torso, clone.Torso) |
38 | char.Torso.CFrame = workspace.TeleportPart.CFrame * CFrame.new(Vector 3. new( 0 , 5 , 0 )) |
But with certain morphs, I end up like this:
https://gyazo.com/f8409ed32cb76401082f782d7b79ce60
(I'm not supposed to be floating)
I also can't move around. I did some investigating, and it turned out that in this morph, my legs aren't touching the ground for some reason.
https://gyazo.com/866295c43f52b776ff1c9e45570aa175
And this is why I can't move. I don't know how to fix this. Please help!