"Vanishing" Parts due to Camera Movement Bug

! INFODUMP WARNING !
Why I put the word “Vanishing” in quotations is because the parts aren’t increasing transparency or moving away, they just dissapear and stop everything from rendering behind it(except highlights). This will help explain:


There are parts behind it, but only highlights are being rendered. This glitch only happens to those parts, and parts on a different platform. All the parts are just normal parts, rectangular, and the most complicated parts in the game are the character parts. This happens both on Roblox studio and normal Roblox, this happens on other devices too. Also when it transitions from visible to invisible, Position nor Transparency changed, my workspace settings are all default, when I deleted everything in lighting, it still glitched. I don’t know why it happens, doesn’t happen immediately when I join, just starts after a minute or so, don’t know what triggers it. This ain’t a bug, its a cockroach.
This is the game it’s glitching on, your gonna have to fool around for a few minutes to find it out.

This was before posted in Building Support, but if I disable all my scripts it doesn’t happen, so I can safely classify this as a Scripting Glitch(Let’s be real, scripting support gets way more traffic). I have another post of similar name in building support, but nobody responded. What I want to do Is at least stop this bug or hide it. Also I have a script that I suspect it too cause the glitch, though it seems innocent, the script is supposed to keep the player from escaping from one platform and run away.

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local player = Players.LocalPlayer
local character = script.Parent
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")

-- Configuration
local PLATFORM_SIZE = 100
local SPACING = 35
local MIRROR_DISTANCE = PLATFORM_SIZE + SPACING -- 135 studs

-- Define both platforms with their centers and boundaries
local PLATFORMS = {
	{
		name = "Platform1",
		center = Vector3.new(-80.35, 33.5, -207.35),
		halfSize = (PLATFORM_SIZE + SPACING) / 2 -- 67.5 studs from center to edge
	},
	{
		name = "Platform2", 
		center = Vector3.new(-30.35, 86.2, -157.35),
		halfSize = (PLATFORM_SIZE + SPACING) / 2 -- 67.5 studs from center to edge
	}
}

-- Anti-flicker variables
local lastTeleportTime = 0
local TELEPORT_COOLDOWN = 0.1
local currentPlatform = nil -- Track which platform player is on

-- Wait for character to settle
wait(1)

-- Function to find which platform the player is closest to
local function findNearestPlatform(position)
	local nearestPlatform = nil
	local shortestDistance = math.huge

	for _, platform in ipairs(PLATFORMS) do
		local distance = (position - platform.center).Magnitude
		if distance < shortestDistance then
			shortestDistance = distance
			nearestPlatform = platform
		end
	end

	return nearestPlatform
end

-- Function to wrap a coordinate relative to a platform center
local function wrapCoordinate(value, threshold, distance)
	if value > threshold then
		return value - distance
	elseif value < -threshold then
		return value + distance
	end
	return value
end

-- Function to wrap player position
local function wrapPosition()
	if not humanoidRootPart or not humanoidRootPart.Parent then
		return
	end

	local currentTime = tick()
	if currentTime - lastTeleportTime < TELEPORT_COOLDOWN then
		return
	end

	local currentCFrame = humanoidRootPart.CFrame
	local currentPos = currentCFrame.Position

	-- Determine which platform we're on
	local platform = findNearestPlatform(currentPos)
	currentPlatform = platform

	-- Calculate position relative to this platform's center
	local relativePos = currentPos - platform.center
	local threshold = platform.halfSize

	-- Check all three axes for wrapping
	local newX = wrapCoordinate(relativePos.X, threshold, MIRROR_DISTANCE)
	local newY = wrapCoordinate(relativePos.Y, threshold, MIRROR_DISTANCE)
	local newZ = wrapCoordinate(relativePos.Z, threshold, MIRROR_DISTANCE)

	-- Check if we actually crossed a boundary (moving outward from platform center)
	local needsWrap = false
	local finalX, finalY, finalZ = relativePos.X, relativePos.Y, relativePos.Z

	if newX ~= relativePos.X and math.abs(relativePos.X) > math.abs(newX) then
		finalX = newX
		needsWrap = true
	end
	if newY ~= relativePos.Y and math.abs(relativePos.Y) > math.abs(newY) then
		finalY = newY
		needsWrap = true
	end
	if newZ ~= relativePos.Z and math.abs(relativePos.Z) > math.abs(newZ) then
		finalZ = newZ
		needsWrap = true
	end

	-- Teleport if needed
	if needsWrap then
		local newPosition = platform.center + Vector3.new(finalX, finalY, finalZ)

		-- CRITICAL: Preserve the exact rotation by using lookVector and upVector
		local lookVector = currentCFrame.LookVector
		local upVector = currentCFrame.UpVector
		local rightVector = currentCFrame.RightVector

		-- Reconstruct CFrame at new position with same orientation
		local newCFrame = CFrame.fromMatrix(newPosition, rightVector, upVector, -lookVector)

		-- Store velocity before teleport
		local velocity = humanoidRootPart.AssemblyLinearVelocity
		local rotVelocity = humanoidRootPart.AssemblyAngularVelocity

		-- Teleport
		humanoidRootPart.CFrame = newCFrame

		-- Restore velocities
		humanoidRootPart.AssemblyLinearVelocity = velocity
		humanoidRootPart.AssemblyAngularVelocity = rotVelocity

		lastTeleportTime = currentTime
	end
end

-- Update every frame
RunService.Heartbeat:Connect(function()
	wrapPosition()
end)

1 Like

It looks like it could just be a roblox rendering bug

Maybe you could try disabling StreamingEnabled?

I wasn’t able to recreate this, what is your graphics level? And what other devices were you able to recreate this on? Did any of them take different amount of times for this to start happening? My only other theory is that maybe some script is taking up so much memory the rendering starts to break, but that doesn’t seem likely at all.

If none of this helps and you don’t find a solution soon, consider moving this post to engine bugs

Tried that, disable and enable StreamingEnabled, also played with Signal Behavior(It’s back to defualt now) - Graphics Level 21, Also dont know how to move posts to engine bugs, not one of the choices