Characters Not Replicating Properly

In our game, players can interact with vaults to be tweened over them. This code has worked as expected for years, however since the ROBLOX replication update, many players have reported that at the end of the vault they get stuck. But they don’t get stuck in a normal way. On their screen, they can continue to move and run around. However on the server they are dangling behind in the air where the vault ended, which means they can’t interact with anything and they go down despite being far away on their screens. Due to the nature of our game and vaults being important, this is a massively gamebreaking issue when it happens. It isn’t consistent, but it’s frequent enough for players to notice.

This is what it looks like for other players:

This is what it looks like for the player themselves:

This is the vaulting code:

local function VaultWork(player, speed, part, anim, vaultVolume, dontAlterAnimSpeed)
	local character = player.Character
	if character then
		local rootPart = character:FindFirstChild("HumanoidRootPart")
		local humanoid = character:FindFirstChildOfClass("Humanoid")

		if rootPart and humanoid then
			rootPart.Anchored = true
			local myAnim = humanoid.Animator:LoadAnimation(anim)
			local mySpeed = (1*(speed/speed))*speed/6
			myAnim:AdjustSpeed(mySpeed)

			local sound = part.Vault_Sound:Clone() 
			sound.Parent = part
			sound.Volume = vaultVolume 
			sound:Play() 
			DB:AddItem(sound, 1)
			myAnim:Play()

			local doorToChar = rootPart.Position - part.Position 
			local baseVelocity = 10
			local finalCFrame
			if doorToChar:Dot(part.CFrame.lookVector) > 0 then
				finalCFrame = part.CFrame * CFrame.new(0,-0.5,-1.5)
			else
				finalCFrame = part.CFrame * CFrame.new(0,-0.5,1.5)
				baseVelocity = -baseVelocity
			end
			rootPart.CFrame = finalCFrame
			rootPart.CFrame = CFrame.lookAt(rootPart.Position, Vector3.new(part.Position.X, rootPart.Position.Y, part.Position.Z))

			local myInfo = TweenInfo.new(speed*1.10, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
			local tween = TS:Create(rootPart, myInfo, {CFrame = rootPart.CFrame * CFrame.new(0,-0.5,-4)})
			tween:Play()

			task.wait(speed-0.05)
			tween:Cancel()

			rootPart.Anchored = false
			pcall(function()
				rootPart:SetNetworkOwner(player)
			end)

			if dontAlterAnimSpeed ~= true then
				myAnim:Stop()
			end
		end
	end
end

Expected behavior

Players are expected to glide over the vault and then be able to move and play as they could before. Not linger behind in the air.

1 Like