I want the button saying “E” to be where the Bulletin board is (adornee)
The button moves im right direction but not really where i want it to
I tried getting screen point and setting it to that
local ContextActionService = game:GetService("ContextActionService")
local mobileActions = {} -- track currently bound actions
local camera = workspace.CurrentCamera
local function updateMobileButtonPositions(adornee)
if not adornee then return end
-- World position + offset above target
local worldPos
if adornee:IsA("BasePart") then
worldPos = adornee.Position + Vector3.new(0, 3, 0)
elseif adornee:IsA("Model") then
worldPos = adornee:GetPivot().Position + Vector3.new(0, 3, 0)
else
return
end
local screenPos = camera:WorldToScreenPoint(worldPos)
if screenPos.Z < 0 then return end -- behind camera
local viewportSize = camera.ViewportSize
local screenX = math.clamp(screenPos.X / viewportSize.X, 0, 1)
local screenY = math.clamp(screenPos.Y / viewportSize.Y, 0, 1)
local actions = {}
for actionName in pairs(mobileActions) do
table.insert(actions, actionName)
end
local count = #actions
if count == 0 then return end
-- Stack buttons vertically using relative scale
local spacing = 0.05 -- 5% of screen height
local startOffset = -spacing * (count - 1) / 2
for i, actionName in ipairs(actions) do
local yOffset = startOffset + (i - 1) * spacing
ContextActionService:SetPosition(
actionName,
UDim2.new(
screenX,
0,
math.clamp(screenY + yOffset, 0, 1),
0
)
)
end
end
Any help is appreciated
