Image pans slightly with mouse

I’m currently working on a menu and I’d like the background image to slightly pan with the the mouse

(Similar to this, but with UI: Camera Panning Slightly for a menu screen

How would I go about making this?

1 Like

Does anyone know how to do this? I’m currently trying to figure it out and am confused

so ive actually figured this out myself. For anyone in the future who’s wondering, here’s my code:

local image = script.Parent
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()

local scale = .1 -- the lower, the farther it goes

scale = scale*100
local screenCenter =,0,0.5,0)

game["Run Service"].RenderStepped:Connect(function()
	local screenSize = workspace.CurrentCamera.ViewportSize
	local mousePosition =,0,mouse.Y/screenSize.Y,0)
	local offset =,0,(mousePosition.Y.Scale-screenCenter.Y.Scale)/scale,0)
	image.Position =,0,0,0) + offset