Player stuck on ground after morphing

Hello! We’re making a simple game where people can choose their favorite hero from a selection, and fight using melee/projectile weapons/powers. The players are spawning at first in an area where they can pick their hero (blue construction),and when they do (move towards a hero rig, a button there checks if a player touched it and morphs the rig on the player) they are moved to the actual map of the game, which is the one below the blue construction. The moving of the players on the actual map is based on the positions of various Spawn Points which are scattered throughout the main road of the map (these points are parts which have the CanCollide option off and are elevated above ground, so as to prevent players getting stuck in the ground).

This is a gif of how the game behaves when a player chooses a hero.
(https://gyazo.com/e18c71d7780c4f4e1ff06c95974b7774)

This screenshot shows the map area and the initial spawning area of the players. (https://gyazo.com/7d278d2196fa9ae791bafbd75aa9037c)

This screenshot shows the spawning points on the map.
(https://gyazo.com/a823e92ff05655367590b1b9adceb8e7)

However, the playtesting sessions showed that some times, when the player is moved to the map, this thing happens (https://gyazo.com/959da0b13d4f96ab17c1de98756102a9). The player bounces off the ground a bit, and then goes into the ground and gets stuck there. You can’t get unstuck if you jump and if you try to use one of your abilities to escape, your Character seems to be frozen and not moving at all (resembles the PlatformStand behavior, but through script we’re checking if this property is true and we set it to false) (https://gyazo.com/22cc6f66972565175d9013c8db727cf9, jumping) (https://gyazo.com/6938fadc9d784cf5c4f0a02a37ce32af, using abilities).

The script below includes the functions that were found responsible to cause the issue. After several commenting out parts of if statements and adding delays to found the cause of the problem, the issue was noticed to happen mainly when the line with Humanoid:ApplyDescription(NewDescription) was activated. We commented it out and through some playtesting sessions we noticed that the issue was not appearing.

--This code teleports the player on the map based on a random SpawnPoint location and applies the morphing based on the hero's rig
function module.init(libs)
	local Debounces = {}
	for _,Hero in pairs(CollectionService:GetTagged("Heroes")) do
		Hero.Button.Touched:Connect(function(Hit)
			local Character = Hit:FindFirstAncestorOfClass('Model')
			local Player = Character and game.Players:GetPlayerFromCharacter(Character)
			if Player then
				if Debounces[Player] then return end
				if not Character:FindFirstChild("ForceField") then return end
				Debounces[Player] = true

				local Spawns = libs.RoundHandler.Map.Spawns
				local RandomSpawn = Spawns:GetChildren()[math.random(#Spawns:GetChildren())]
				Character.HumanoidRootPart.CFrame = RandomSpawn.CFrame * CFrame.new(0,5,0)
				Character.Humanoid.WalkSpeed = 20
				Player:SetAttribute("Hero",Hero.Name)
				DoMorph(Hero.Rig,Character)
				if Character.Humanoid.PlatformStand == true then
					print("PlatformStand",Character.Humanoid.PlatformStand)
					Character.Humanoid.PlatformStand = false
				else
					print("PlatformStand",Character.Humanoid.PlatformStand)
				end
				local Weapons = game.ReplicatedStorage.Tools:FindFirstChild(Hero.Name)
				if Weapons then
					for _,Weapon in pairs(Weapons:GetChildren()) do
						Weapon:Clone().Parent = Player.Backpack
					end
				end
				if Character:FindFirstChild("ForceField") then
					Character.ForceField:Destroy()
				end
				wait(.5)
				Debounces[Player] = false
			end
		end)
	end
end

--This function is responsible for morphing a rig on a player
function DoMorph(Rig,Character)
	local Humanoid = Character.Humanoid
	Humanoid:RemoveAccessories()
	local OldDescription = Character.Humanoid:GetAppliedDescription()
	local NewDescription = Rig.Parent.HumanoidDescription:Clone()

	for _,v in pairs(Propertiestoclone) do
		NewDescription[v] = OldDescription[v]
	end
	
	NewDescription.Parent = Character

	Humanoid:ApplyDescription(NewDescription)

	if Humanoid.PlatformStand == true then
		Humanoid.PlatformStand = false
	end
	for _, Thing in next, Rig:GetChildren() do
		if Thing.Name == 'Head' then
			local Face = Thing:FindFirstChild('face')
			if Face then
				if Character.Head:FindFirstChild("face") then
					Character.Head.face:Destroy()
				end
				local face = Face:Clone()
				face.Parent = Character.Head
			end
		elseif Thing:IsA('Accessory') then
			local Handle = Thing:FindFirstChild("Handle")
			if Handle then
				Handle.CanQuery = false
			end
			Humanoid:AddAccessory(Thing:Clone())
		elseif Thing:IsA('Hat') then
			local Handle = Thing:FindFirstChild("Handle")
			if Handle then
				Handle.CanQuery = false
			end
			Humanoid:AddAccessory(Thing:Clone())
		elseif Thing:IsA('Shirt')  or Thing:IsA('ShirtGraphic') or Thing:IsA('Pants') or Thing:IsA('BodyColors') then
			local Oof = Character:FindFirstChildWhichIsA(Thing.ClassName)
			if Oof then
				Oof:Destroy()
			end
			local thing = Thing:Clone()
			thing.Parent = Character
		end
	end
end


We’ve tried multiple options:

  • Checking if PlatformStand option (Humanoid) was set to true, which never happened

  • Changed the density of the rigs to 0.01 (CustomPhysicalProperties), but this didn’t solve our issue

  • Setting the AutomaticScalingEnabled to false (Humanoid), still the issue persists

The issue could possibly lie on the fact that the players have different sizes. The hero rigs are R16 avatars, whereas mine is a simple R5 avatar. This was also noticed for the players of other colleagues who playtested the game and their avatars were different from the hero rigs.

Any potential issues that can be noticed in this implementation, or any ideas as to what could be going wrong, feel free to let me know! Also, let me know if more information are needed! Thank you in advance! :slight_smile:

Try to turn off “CharacterAutoLoads” which is located in the Player Service, this might help. Also force all characters to be r15 in the game settings.

That’s what I was thinking, also you could use this script to do it:


local Players = game.Players

function PlayerJoined(Player)
 local function RemoveMeshes(Character)
  local Humanoid = Character:WaitForChild("Humanoid")
  wait()
  local CurrentDescription = Humanoid:GetAppliedDescription()
  
  CurrentDescription.Head = 0
  CurrentDescription.Torso = 0
  CurrentDescription.LeftArm = 0
  CurrentDescription.RightArm = 0
  CurrentDescription.LeftLeg = 0
  CurrentDescription.RightLeg = 0
  Humanoid:ApplyDescription(CurrentDescription)
 end
 Player.CharacterAdded:Connect(RemoveMeshes)
end

Players.PlayerAdded:Connect(PlayerJoined)

https://gyazo.com/9fbeb10bc8c6a12f17c9b87dfe7f0977

This has also been set to have R15 characters in the game, probably should have mentioned that in the initial post, my bad.

Used that script in the corresponding CharacterAdded function but again the issue persists :confused: From some other feedback I got, there might be issues with the HipHeight (which is automatically adjusted, first print is my player’s hip height before morphing, second one is after morphing https://gyazo.com/3c3ad385766dd3ae6ef3b5c77f7c1f8b), I’m going through some posts on the DevForum about the hip height to understand if it could affect the player’s weird behavior, but I also will check this link (Changing Packages Causes Player to Fall Over? - #5 by Kampfkarren). If any other idea/suggestion pops up please let me know!

EDIT1: Checked the hip height, didn’t encounter the issue but one other developer encountered the bug again. This could probably be an issue with the characters, because I have the default one with no accessories or different body parts but the other developer does.

Do the players have different avatar animations?

We have some custom animations for the powers each hero uses and idle animations. There’s a LocalScript in the StarterPlayerScripts that assigns these animations to the state of the player. I disabled that script and did some more test runs but the issue still appears.

1 Like

Update: I made a test place and integrated our game components gradually. In that manner it was easier for me to see the differences between the test place and the game place. I noticed though that the test place didn’t have the option of StreamingEnabled on, whereas the game place did. What I found out through some playtesting is that the issue we had was not appearing in the test place but did so when I turned StreamingEnabled on. I found through some digging in the DevForum lots of questions about this option and teleporting (which wasn’t causing any issues in our game) but I haven’t found any information that correlates morphing a character into a rig and StreamingEnabled being on. Does anyone have an idea of what could be going on in this case???