ContextActionService:SetPosition not working

I’m trying to position a button, but it’s not working.

image

My code:

local ContextActionService = game:GetService('ContextActionService')

local function Touch()
	warn('Ok')
end

ContextActionService:BindAction('Touch', Touch, true)
ContextActionService:SetTitle('Touch', 'Touch')
ContextActionService:SetPosition('Touch', UDim2.new(0.85, 0, 0.433, 0)) -- Position

ContextActionService’s button placement is not relative to your viewport, but an invisible square area on the bottom right of the screen which size depends on your viewport size

You can try setting it to UDim2.new(0, 0, 0, 0))
to see where the top-left of that square and then move your buttons according to that

2 Likes

SetPosition is relative to a Frame called ContextButtonFrame inside ContextActionGui ScreenGui inside the PlayerGui, so the positions are relative to ContextButtonFrame’s position which is UDim2.new(0.7,0,0.5,0)

1 Like