Hey, I have an issue with jointing players, as seen in the first video below. (First video shows things going wrong, second video shows how it’s supposed to work) Sometimes, it seems that the player on top still applies physics despite me having done tricks such as:
- Changing their network ownership
- Making the character PlatformStand
- Change their state to Physics, using ChangeState
- Adding BodyForces to nullify gravity
The first and last list item above can be found in this code snippet:
local function setNetworkForCharacter(char, owner, weightless) -- (Model, Player, boolean) local hrp = char:FindFirstChild("HumanoidRootPart") for _, obj in next, char:GetChildren() do -- the GetRootPart() check is just to limit our search to player limbs only -- (there are parts we don't want to modify, but those aren't jointed with the character) if obj:IsA("BasePart") and obj:GetRootPart() == hrp then if obj:CanSetNetworkOwnership() then obj:SetNetworkOwner(owner) end if weightless then -- notion to reuse if our BodyForce already exists, for whatever reason local bf = obj:FindFirstChild("PStackWeight") or Instance.new("BodyForce") bf.Name = "PStackWeight" bf.Force = Vector3.new(0, workspace.Gravity * obj:GetMass(), 0) bf.Parent = obj elseif obj:FindFirstChild("PStackWeight") then obj:FindFirstChild("PStackWeight"):Destroy() end end end end
Anyone know what causes the undesired behavior from the first video, and how to fix it without having other players see the top player’s character stutter with their offset from the lower player (in case someone suggests to CFrame the upper player)?
Here is a test place file, demonstrating the buggy behavior of the first video.
PlayerStackingBugReproduction.rbxl (13.3 KB)
Solved by having an anchored part keeping the top player locked, which the clients update relative to the lower player’s HRP.