So I am working on this reward wheel that will randomly give you a reward every 24 hours.
The issue is when I tween the random rotation there are 2 problems.
- It doesn’t tween fast enough and 2. It doesn’t tween long enough
This is my code:
local rotAmount = Random.new():NextInteger(1, 4) * 360
local ts = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
local tweenInfo2 = TweenInfo.new(spinTime, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
local goalSector = workspace.Wheel.Rewards[rewardPos]
print(goalSector)
local sectorRot = goalSector.Rotation
rotAmount += (360 - sectorRot)
local rotationTween = ts:Create(workspace.Wheel, tweenInfo2, {CFrame = workspace.Wheel.CFrame * CFrame.Angles(rotAmount, 0, 0)})
rotationTween:Play()
rotationTween.Completed:Wait()
azqjanna
(azqjanna)
#2
Is it not spinning more than one full turn?
Try this
local rotAmount = Random.new():NextInteger(1, 4) * 360
local ts = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out) -- Adjust the duration to make it faster
local tweenInfo2 = TweenInfo.new(spinTime, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
local goalSector = workspace.Wheel.Rewards[rewardPos]
print(goalSector)
local sectorRot = goalSector.Rotation
rotAmount += (360 - sectorRot)
local rotationTween = ts:Create(workspace.Wheel, tweenInfo2, {CFrame = workspace.Wheel.CFrame * CFrame.Angles(rotAmount, 0, 0)})
rotationTween:Play()
rotationTween.Completed:Wait()
2 Likes
THIS WORKED PERFECTLY! Thanks a lot!
1 Like
system
(system)
Closed
#5
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.