Teleporting player via HumanoidRootPart.Position causes players to turn invisible/glitch all over the map

After hours trying to figure out this issue in a local studio session, I have finally figured out what the issue was on my end.

This is definitely a roblox bug, and can be reproduced by:
1. Have an Accessory parented to the Character
2. Have a part with a decal inside, with the part being apart of the Accessory
3. At Heartbeat / any sort of loop (haven’t tried just setting once), change the decal’s color or any other property.

By doing this, you will completely break any other characters until you zoom into first person.

4 Likes

We had this exact split-character issue when testing an unreleased StreamingEnabled flag. Is this related? @CorvusCoraxx

Thanks for the clear repro place. @orange451 this is occurring even when the place is not streaming enabled, so it is a different issue.

If I change the teleport from:

local humanoid_root_part = character:FindFirstChild("HumanoidRootPart")
   
   if humanoid_root_part then
   	humanoid_root_part.Position = tp_part_b.Position + tp_part_b.CFrame.LookVector*5
   end

to:

character:SetPrimaryPartCFrame(CFrame.new(tp_part_b.Position + tp_part_b.CFrame.LookVector*5))

the problem seems to go away for me. Is there a reason the Model SetPrimaryPartCFrame method cannot be used?

5 Likes

I guess it could be used, but it’d have to then be set as the new standard.

Ever since I started scripting on Roblox I’ve always heard that setting the HumanoidRootPart’s Position / CFrame is preferred, and even the wiki encourages this: https://developer.roblox.com/en-us/articles/How-to-teleport-within-a-Place

What I’m mostly curious about this situation is why setting just the Root part’s position causes it to fail but SetPrimaryPartCFrame doesn’t.

2 Likes

I just tested using

		humanoid_root_part.CFrame = CFrame.new(tp_part_b.Position + tp_part_b.CFrame.LookVector*5)

instead of

humanoid_root_part.Position = tp_part_b.Position + tp_part_b.CFrame.LookVector*5

and I didn’t see the issue. As the wiki link you shared says:

Teleportation is a term given to the act of moving a group of parts, typically a player’s character, to a certain coordinate. In Roblox, setting the  `Position`  property of a parts would disconnect the part from any other parts connected to it and break the model. Therefore, one cannot use the following to teleport a player because it would disconnect the Torso from the Head. Doh!

1. game.Workspace.Player.Torso.Position = Vector3.new(0, 50, 0)

To correctly teleport a player without killing them, you must use the CFrame property and use the [CFrame](https://developer.roblox.com/articles/Understanding-CFrame) data type instead.

I’m not using the Position property to teleport users and I don’t think MetatableIndex is either. My issue is that, even after resolving this issue by teleporting via CFrame, I’ve noticed that this bug is occuring in my game again at arbitrary points. I have not been able to reduce it down to a repro, but I certainly am not teleporting players via the Position property and have not been for about a year now. I had to rewrite all my code to remove it, after all. I may try the SetPrimaryPartCFrame, but I don’t see how that would be any different than what I already do.

1 Like

You should be making a new thread for this since it is getting quite confusing to follow the thread.

Yes, if you have a repro using CFrame please make a new post about it.

2 Likes

Any update on this? It seems to have happened to me today, players are reporting being invisible to each other (I am CFraming their HumanoidRootPart on the client).

This happens to my players and NPCs. It happens rarely to players’ characters that are teleported using HumanoidRootPart.CFrame and more commonly to zombie NPCs teleported using the same teleport method.

I can never replicate it on my own computer nor can certain people replicate it on their computers. I think it only replicates on older and poorer computers on lower graphics settings. Is there any fix coming?

Example: Invisible zombies

1 Like

image
It seems like that the character on the client side is fine but on the server side the character is floating off somewhere else.

5 Likes

Personally it worked so I think you should put that as solution

I used your method of fixing things and yet when I go on the server I’m still levitating beneath the ground. I have my characters Archivable set to (I checked if it was true thinking that could be the issue) but I’m still bugged. Down there, this is very annoying….

Never mind, my issue was that I welded a part to the players right arm on the client. Instead, I did it on a server script and used the following code to fix it.

script.Parent.OnServerEvent:Connect(function(Player, Action)
if Action == “Equip” then
local KProp1 = game.ReplicatedStorage.Props.PropKunai:Clone()
KProp1.Parent = game.Workspace
KProp1.Name = Player.Name…”sKunaiProp”
local PropW1 = Instance.new(“Weld”, KProp1)
PropW1.Part0 = KProp1
PropW1.Part1 = Player.Character[“Right Arm”]
PropW1.C0 = CFrame.new(0,1,0) * CFrame.Angles(0,math.rad(45),0)

elseif Action == “Unequip” then
local KProp1 = workspace:WaitForChild(Player.Name…”sKunaiProp”):Destroy()

end
end)

So yeah, the issue was what @MetatableIndex was talking about, special thanks to him for letting us know!

You should never be setting the position of the the HumanoidRootPart anyway, you should use :MoveTo() on the character instead.

3 Likes

You can’t CFrame other characters from your client. Do it from the server and they won’t be invisible

1 Like

I also had a problem with teleporting because whenever I teleported my character using CFrame or Position, the attachments on my weapons and accessories would scatter all around the map making the hitboxes and shooting points really weird. I happen to have Commander 4 by Evo, so I looked into their teleport script and I noticed that they used SetPrimaryPartCFrame() for their model. I looked deeper and turns out there was a new version of that, PivotTo().

I switched all of my teleporting things to PivotTo(targetCFrame) and so far I haven’t run into any more attachment part problems regarding teleportation. I know this was a really late post, but I hope this helps!

10 Likes

I had this problem Multiple times. I fixed it by teleporting by “CFrame” instead of “Position”

Best is to use remote event to client > server OR use just server. Never use Just Client.

The solution I found awhile back is to this is to reset the rootjoint’s original C0 / C1 after teleporting.