Ui does not rotate correctly

hello i have a problem where my ui does not rotate correctly on the circle
i want it to keep facing the side of the circle

local current_deg = 0
local speed = 0.5 
game:GetService("RunService").Heartbeat:Connect(function()
	if not freezing then 
		current_deg +=speed
		script.Parent.Move.Rotation  = current_deg
		script.Parent.Move.Position = UDim2.new(math.cos(current_deg)*0.5,script.Parent.Size.X.Offset/2,math.sin(current_deg)*0.5,script.Parent.Size.Y.Offset/2)
	end
end)

image

1 Like

Is a ViewportFrame a type of ScreenGui?

1 Like

that frame is a part of another frame

Technically this does work no? It’s just that you’ve been trying to tinker and guess the increments of which it rotates at. Have you tried getting the rotational increments (local speed) based on the Circle’s radius/size in pixels?

Lua’s trig functions require arguments in radians whereas gui.Rotation is in degrees, use math.rad to convert current_deg to degrees before the function calls.

1 Like


(dont mind the video on the side i put it there for the funny when sending the problem to my friend my apologize if it hurt your brain )

oh that worked thanks for help

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.