I need help with making my UI rotate in a tween. Right now I have it as a math.random put it picks one of the random ones in the table and keeps rotating it to the same number, But I want it to switch between different numbers
here’s my script
local frame = script.Parent.Frame
local detection = script.Parent.detection
local ts = game:GetService("TweenService")
local ti = TweenInfo.new(0.3, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
local rotation_table = {
5, -- 1
1, -- 2
2.5, -- 3
-5, -- 4
-1, -- 5
-2.5 -- 6
}
local MEgoal = {}
MEgoal.Position = UDim2.new(0.5, 0, 0.45, 0)
local MLgoal = {}
MLgoal.Position = UDim2.new(0.5, 0, 0.5, 0)
local MERG = {}
MERG.Rotation = rotation_table[math.random(1,6)]
local MLRG = {}
MLRG.Rotation = 0
local METween = ts:Create(frame, ti, MEgoal)
local MLTween = ts:Create(frame, ti, MLgoal)
local MERT = ts:Create(frame, ti, MERG)
local MLRT = ts:Create(frame, ti, MLRG)
detection.MouseEnter:Connect(function()
MERT:Play()
METween:Play()
end)
detection.MouseLeave:Connect(function()
MLTween:Play()
MLRT:Play()
end)