Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why Isn't my Morphed Character Moving?

Asked by 5 years ago

I have created a few morphs for my game. When I morph my character to something else, this is how I do it:

local function removeAccessories(char)
    for i,v in pairs(char:GetDescendants()) do
        if v:IsA("Accessory") or v:IsA("Hat") or v:IsA("Decal") or v:IsA("ShirtGraphic") then
            v:Destroy()
        end
    end
end

local function removeBody(char)
    for i,v in pairs(char:GetDescendants()) do
        if v:IsA("BasePart") or v:IsA("UnionOperation") or v:IsA("MeshPart") then
            v.Transparency = 1
            v.CanCollide = false
        end
    end
end

local function weld(a, b)
    local w = Instance.new("ManualWeld", a)
    w.Name = a.Name.."_Weld_"..b.Name
    w.C0 = a.CFrame:inverse() * b.CFrame
    w.Part0 = a
    w.Part1 = b
end

game.ReplicatedStorage.MorphEvent.OnServerEvent:Connect(function(plr, morph)
    local clone = morph:Clone()
    local char = plr.Character

    removeBody(char)
    removeAccessories(char)

    clone.Parent = char
    local pos = clone.Torso.Position
    clone.Torso.CFrame = char.Torso.CFrame - Vector3.new(0, (char.Torso.Position.Y - pos.Y) * 2, 0)
    weld(char.Torso, clone.Torso)

    char.Torso.CFrame = workspace.TeleportPart.CFrame * CFrame.new(Vector3.new(0, 5, 0))
end)

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!

0
It is probably the morph, your character is getting mixed up with a morph, that could be one reason.. greatneil80 2647 — 5y
0
Humanoid has a property called HipHeight. Make sure you set that to the correct size. Also make sure the morph's parts are unanchored. xPolarium 1388 — 5y
0
Line 11 is a complete waste. It can be shortened to "if v:IsA("BasePart") then". Same for the removeAccessories function. The Humanoid class has a method called RemoveAccessories. User#19524 175 — 5y
0
@incapaz I added that so it would remove the face as well. Zenith_Lord 93 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Check for anchored parts. If the morph welds together, any anchored parts would prevent it from moving.

Edit: Humanoid parts are required to have a functioning morph: - Humanoid - Humanoid Root Part - Torso - Head

0
Nope, no anchored parts. What's happening is that the legs of the character are off the ground, and so they can't walk/jump. Zenith_Lord 93 — 5y
0
You still have the humanoid, torso, head, etc? You need those to have a functioning morph. They can be invisible. chexburger 358 — 5y
0
Yep, I have humanoidrootpart, humanoid, and torso. no legs/arms/head Zenith_Lord 93 — 5y
0
Really I'm just welding the torsos, I'm trying to figure out why I end up above my morph. Zenith_Lord 93 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

bump since i need an answer

Answer this question