ClockArrow Problem

local function rotateClockHand(hand, angle)
    -- Apply rotation animation to the hand's angle
    hand.Rotation = angle
end


local function updateClockHands(hours, minutes, seconds)
    -- Calculate angles for the clock hands
    local hourAngle = 30 * (hours % 12) + 0.5 * minutes -- 360 degrees in 12 hours, 30 degrees in 1 hour, 0.5 degrees in 1 minute
    local minuteAngle = 6 * minutes + 0.1 * seconds -- 360 degrees in 60 minutes, 6 degrees in 1 minute, 0.1 degrees in 1 second
    local secondAngle = 6 * seconds -- 360 degrees in 60 seconds, 6 degrees in 1 minute, 6 degrees in 1 second

    -- Update positions of the clock hands using animation
    rotateClockHand(gui.Clock.MainClock.HourArrow, hourAngle)
    rotateClockHand(gui.Clock.MainClock.MinuteArrow, minuteAngle)
    rotateClockHand(gui.Clock.MainClock.SecondArrow, secondAngle)
end

I’m making the clock hands move when I click, and at the moment I have this result:

As you can see there are flaws and I want to know how to fix them, first of all can you tell me how not to change the position of the arrows? Because initially they are in this position

And when you start the game, you may notice that the arrows change their position, so I would like to know how do I fix it?

Change AnchorPoint for better rotation of Frame

1 Like