Hey! I want to make my game mobile-friendly, which means I can’t put guis at the lower left and right corners. Other games (like roblox bedwars) have buttons around the jump button. How do I position buttons around the jump button in a circle? I saw this post where they put a button on top of and left of the jump button, but what if I want to put something diagonally across?
To position buttons around the jump button in a circle, you can use the following approach:
Calculate the position of each button relative to the center of the circle.
Use the “Position” property of each button to position them at their respective coordinates.
Use trigonometry to calculate the X and Y coordinates of each button relative to the center of the circle.
Use the “AnchorPoint” property of each button to center them on their respective coordinates.
Here’s an example of how you can use trigonometry to position a button at a 45-degree angle from the jump button:
local jumpButton = -- get the jump button object
local angle = math.rad(45) -- convert the angle to radians
local radius = 50 -- set the radius of the circle
local x = jumpButton.Position.X + radius * math.cos(angle)
local y = jumpButton.Position.Y + radius * math.sin(angle)
local newButton = Instance.new("TextButton") -- create a new button
newButton.Position = UDim2.new(0, x, 0, y) -- set its position
newButton.AnchorPoint = Vector2.new(0.5, 0.5) -- center it on its position
newButton.Parent = -- parent the button to the GUI
You can repeat this process for each button, using a different angle for each one to position them evenly around the circle.