In my game, I notice that on rare occasion a player might not get teleported like they should. I never get an error or warning and the code never yields, the player just doesn’t move. Maybe setting the hrp CFrame would be better?
local character = (player.Character or player.CharacterAdded:Wait())
character:PivotTo(destroyerSpawn.CFrame)
Yes, for models that are moving you should use directly the PrimaryPart of the model over Pivot().
PivotTo() also has a bug that sometimes it can trigger the Humanoid:MoveTo() method.
local function bring(player: Player, otherPlayer: Player)
if not directors[player.UserId] then return end
if not sanityChecks.target(player, otherPlayer) then return end
if not limiter:isOver("bring", player) then return end
local character = player.Character
local otherCharacter = otherPlayer.Character
if character and otherCharacter and character ~= otherCharacter then
otherCharacter:PivotTo(character:GetPivot()); print("bring")
end
end
The code in the post is the quite literally the code used. the print only prints once per click, and there’s no loop nowhere at all, and the client side is just a FireServer. edit: The problem is not my code.
You might think the issue could be Iris internal, but again, there’s a cooldown in the server-side of 1s.
I might have confused you. My post isn’t his code, it’s directly from my place. The reason I shared is because OP thinks PivotTo() “doesn’t always work,” so to add on to that I shared my case with PivotTo() as well, because this could catch the attention of a staff member.
OK. I think the issue isn’t PivotTo(). I think it’s likely that the player is being moved too close to a part and the character’s default scripts are moving the character similarly to what would happen with Humanoid:MoveTo(). I use PivotTo() a lot and in every case I use it, it behaves exactly as setting the CFrame would.
That could be the case yeah. But it doesn’t remove the fact that something really is happening, so either Roblox should fix their PlayerModule or check if anything is going on with the physics replication and PivotTo()
Either way, that’s a good theory, so I’m going to keep experimenting with this.
I removed the PlayerModule from player2 who doesn’t have access to Iris and he is unable to move at all.
But same problem, in conclusion: this isn’t a problem with the ‘PlayerModule’ but PivotTo() or Humanoid:MoveTo() or in extreme cases, the physics replication.
I think it might just be his implementation. I think it may be inconsistent in combination with the default character scripts, but I doubt it won’t teleport them at all like OP details.
I have discovered that if you set the collision for both players to false using PhysicsService, PivotTo() finally works perfectly fine as it should.
So this was really a problem with physics replication and how both humanoids interacted with each other BaseParts, I think one tried to steal the NetworkOwnership of the other.
@Geolio9 I think your previous theory was 100% right.
In this case, the part are player1 descendants of the character. Perhaps, PivotTo() works to well for its own good?
You always have network ownership over your character and anything you have network ownership of you handle the physics for, so there should be no issues with physics replication. I think it’s the humanoid scripts.
I agree that each player has ownership over their character, but if the latter would be the case PhysicsService should not have fixed the problem, or the problem should not have existed to begin with, so I really think there is something else going on.
I literally had to remove Collision physics between both characters in order to fix, so the problem is physics replication, especially collisions.