#how to get a frame's canvasposition inside a scrollingframe?

3 messages · Page 1 of 1 (latest)

ionic niche
#

you can do some vector math using the frames 'AbsolutePosition' property and the parents 'AbsolutePosition' property. Basicly, you're gonna need the difference between those vector so just subtract the frames absPos from the parents absPos and you have what the canvasPosition should be:

local frame = script.Parent.Frame
local canvas = script.Parent

local function getCanvasPosition(Frame)
  local differenceVector = canvas.AbsolutePosition - Frame.AbsolutePosition
  return UDim2.new(0, differenceVector.X, 0, differenceVector.Y)
end

canvas.CanvasPosition = getCanvasPosition(frame)
hexed quartz
#

ok i got it to work