Rotation causes a 1 pixel offset

I first noticed this issue in studio
when rotating a GuiObject (only tested with Frame and TextButton) it seems to offset the rotated GuiObject by 1 pixel

I made a game that reproduces the issue https://www.roblox.com/games/116315907294818/Rotation-Pixel-Offset-Bug

Replication code:

local ScreenGui = Instance.new("ScreenGui") do
	ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
	ScreenGui.Parent = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui")

	local GreenFrame = Instance.new("Frame") do
		GreenFrame.Name = "GreenFrame"
		GreenFrame.Size = UDim2.fromOffset(300, 300)
		GreenFrame.BorderColor3 = Color3.fromRGB(0, 0, 0)
		GreenFrame.Position = UDim2.new(0.5, -150, 0.5, -150)
		GreenFrame.BorderSizePixel = 0
		GreenFrame.BackgroundColor3 = Color3.fromRGB(26, 255, 0)
		GreenFrame.Parent = ScreenGui

		local BlackFrame = Instance.new("Frame") do
			BlackFrame.Name = "BlackFrame"
			BlackFrame.Size = UDim2.fromScale(1, 1)
			BlackFrame.BorderColor3 = Color3.fromRGB(0, 0, 0)
			BlackFrame.Rotation = 180
			BlackFrame.BorderSizePixel = 0
			BlackFrame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
			BlackFrame.Parent = GreenFrame

            local Status = Instance.new("Hint", workspace)

            local function UpdateStatus(Rotation : number)
                Status.Text = `BlackFrame | {Rotation} rotation`
            end

            local function Update()
                task.wait(2)
                BlackFrame.Rotation += BlackFrame.Rotation ~= 180 and 90 or -360
                UpdateStatus(BlackFrame.Rotation)
            end

            BlackFrame:GetPropertyChangedSignal("Rotation"):Connect(Update)
            UpdateStatus(BlackFrame.Rotation)
            Update()
		end
	end
end

Ignore the incorrect frame names in the hint it should say BlackFrame

PC Resolution: 1920x1200 (125% zoom)
PC POV

PC Resolution: 1920x1080 (125% zoom)
PC POV

Mobile Resolution: 2532x1170 (no zoom)
Mobile POV

Expected behavior

The expected result should be that there is no green rather it should all be black (aka no pixel shift)

3 Likes