Character phasing through ground

Description of Problem
In my game, I have a script which creates a copy of the player’s character when a new player joins and places that new character in a certain position (the position is -18.325, 3, -5.8). Normally, the new character should be standing properly on the surface of the baseplate.
However, if a player has different dimensions other than the default one, they will phase through the ground. I have figured out this is most likely caused by having the HumanoidRootPart anchored, however, I need the HumanoidRootPart to be anchored in order for the game to function properly. I need help with automatically detecting if the character is phasing through the ground and placing it on the surface.

Current Code

local Players = game.Players
local SpawnPosition = CFrame.new(-18.325, 3, -5.8)

Players.PlayerAdded:Connect(function(plr)
	local newChar = Players:CreateHumanoidModelFromUserId(plr.UserId)
	newChar.PrimaryPart.Anchored = true
	newChar:PivotTo(SpawnPosition)
	newChar.Parent = workspace
end)

Images

What I want the character to look like:
image

What it looks like with my code:
legphasing

1 Like

Find HipHeight in your Humanoid and increase the value (or decrease)

1 Like