Hello devs! So I am working on main menu, and I want Image kind of “orbit” around Text, if you don’t know what I mean, this is example from another (non Roblox) game :
1 Like
Hi, for that just use math.cos, math.sin and tick() function
A small exemple here:
local textLabel = script.Parent.TextLabel
local image = script.Parent.ImageLabel
local SPEED = 50
local RADIUS = 70
game:GetService("RunService").RenderStepped:Connect(function()
local pos = textLabel.AbsolutePosition + (textLabel.AbsoluteSize - image.AbsoluteSize) * .5
local x = math.rad(tick() * SPEED)
local xOffset = math.cos(x) * RADIUS
local yOffset = math.sin(x) * RADIUS
pos = pos + Vector2.new(xOffset, yOffset)
image.Position = UDim2.fromOffset(pos.X, pos.Y)
end)
2 Likes