Hello! I am making a Main Menu Gui for a pokemon game I am developing for fun (I do not plan on releasing it). But I added a cursor to the menu icons and when you go back and forth, the rotation becomes off axis? (See Attached Video) Can anyone help me with this?
There are two pieces of code, one for scrolling right:
DebugItems()
UIPageLayout:Next()
Sounds.Gui.SmallBlip.PlaybackSpeed = 1.2
Sounds.Gui.SmallBlip:Play()
ArrowRight.Position = UDim2.new(
ArrowRight.Position.X.Scale + .01,
ArrowRight.Position.X.Offset,
ArrowRight.Position.Y.Scale,
ArrowRight.Position.Y.Offset)
Cursor.Rotation = Cursor.Rotation
TweenService:Create(Cursor,
TweenInfo.new(.5, Enum.EasingStyle.Back, Enum.EasingDirection.Out),
{Rotation = Cursor.Rotation + 90}):Play()
MenuLabel.Position = UDim2.new(.342, 0, .637, 0)
MenuLabel.TextTransparency = 1
MenuLabel.UIStroke.Transparency = 1
MenuLabel.Text = UIPageLayout.CurrentPage.UIname.Value
HighlightCurrentItem()
FadeModule:FadeText(MenuLabel, 0, .2)
FadeModule:FadeStroke(MenuLabel.UIStroke, 0, .2)
ArrowRight:TweenPosition(
UDim2.new(
ArrowRight.Position.X.Scale - .01,
ArrowRight.Position.X.Offset,
ArrowRight.Position.Y.Scale,
ArrowRight.Position.Y.Offset),
Enum.EasingDirection.Out,
Enum.EasingStyle.Back,
.2,
true)
MenuLabel:TweenPosition(UDim2.new(.342, 0, .531, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Back, .2, true)
And one for scrolling left:
DebugItems()
UIPageLayout:Previous()
Sounds.Gui.SmallBlip.PlaybackSpeed = 1.2
Sounds.Gui.SmallBlip:Play()
ArrowLeft.Position = UDim2.new(
ArrowLeft.Position.X.Scale - .01,
ArrowLeft.Position.X.Offset,
ArrowLeft.Position.Y.Scale,
ArrowLeft.Position.Y.Offset)
Cursor.Rotation = Cursor.Rotation
TweenService:Create(Cursor,
TweenInfo.new(.5, Enum.EasingStyle.Back, Enum.EasingDirection.Out),
{Rotation = Cursor.Rotation - 90}):Play()
MenuLabel.Position = UDim2.new(.342, 0, .637, 0)
MenuLabel.TextTransparency = 1
MenuLabel.UIStroke.Transparency = 1
MenuLabel.Text = UIPageLayout.CurrentPage.UIname.Value
HighlightCurrentItem()
FadeModule:FadeText(MenuLabel, 0, .2)
FadeModule:FadeStroke(MenuLabel.UIStroke, 0, .2)
ArrowLeft:TweenPosition(
UDim2.new(
ArrowLeft.Position.X.Scale + .01,
ArrowLeft.Position.X.Offset,
ArrowLeft.Position.Y.Scale,
ArrowLeft.Position.Y.Offset),
Enum.EasingDirection.Out,
Enum.EasingStyle.Back,
.2,
true)
MenuLabel:TweenPosition(UDim2.new(.342, 0, .531, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Back, .2, true)
The piece of code Iām assuming is causing the issue is this piece:
Cursor.Rotation = Cursor.Rotation
TweenService:Create(Cursor,
TweenInfo.new(.5, Enum.EasingStyle.Back, Enum.EasingDirection.Out),
{Rotation = Cursor.Rotation +/- 90}):Play()
I want this game prototype to be foolproof so any debugs to stop this bug from happening would be very helpful!