I’m trying to create a radial menu on a BillboardGui using buttons that aren’t square. Problems I am facing is the buttons aren’t container within the BillboardGui (the red frame is the size of the BillboardGui) Problem with this is, even tho ClipDescendants is false, events on buttons don’t fire if you click on the part of the button that’s outside the BillboardGui.
Buttons have an AnchorPoint of 0.5, 0.5. I want to keep this, as I do animations on click/hover and so the buttons size or whatever needs to change from the centre.
local RADIUS = 0.5
local ANGLE_OFFSET = 90
local menuItems = {}
local function New(name, angle, range)
local newItem = {}
local label = Template:Clone()
label.Text = name
label.Name = name
local angleRadians = math.rad(ANGLE_OFFSET + angle)
label.Position = UDim2.new(
0.5 + RADIUS * math.cos(angleRadians),
0,
0.5 - RADIUS * math.sin(angleRadians),
0
)
label.Parent = Container
newItem.Label = label
newItem.Vector = Vector2.new(math.cos(angleRadians), math.sin(angleRadians))
newItem.Range = range
table.insert(menuItems, newItem)
end
local function Update()
Container:ClearAllChildren() -- Empty
local TotalButtons = Amount.Value
for i = 1, TotalButtons do
local angle = (360 / TotalButtons) * (i - 1)
local name = "Option" .. i
New(name, angle, 360 / TotalButtons)
end
end
Amount:GetPropertyChangedSignal("Value"):Connect(Update)
Basically just using the code from the hub, and tried messing with values to get something close to what I want, but can’t get it
Creating a Radial Menu.