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!