Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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:

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!

4 comments

0

It is probably the morph, your character is getting mixed up with a morph, that could be one reason..

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.

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.

0

@incapaz I added that so it would remove the face as well.

2 answers

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

4 comments

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.

0

You still have the humanoid, torso, head, etc? You need those to have a functioning morph. They can be invisible.

0

Yep, I have humanoidrootpart, humanoid, and torso. no legs/arms/head

0

Really I'm just welding the torsos, I'm trying to figure out why I end up above my morph.

This discussion is preserved as it was. New answers, comments, and votes are closed.