How to make Wheel spin more smooth?

Hello I’m Ted.

I have been working on this wheel spin thing, where you click a spin button and it spins a wheel. The problem I have is I’m wondering if there is a more efficient and effective way to make the wheel spin more accurately specifically, when the wheel STARTS to spin it should have a slow start, when the wheel is in the MIDDLE of spinning it should be spinning at a normal rate, and when the wheel comes close to the END of spinning it should start to decrease the speed of it’s rotation.

In my current code, I do this (sort of) but it’s not exactly the best and I can’t tell myself it’s “good enough” because it isn’t. What can or should I do?

Code:

local RunService = game:GetService('RunService')
local UserInputService = game:GetService('UserInputService')

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local SpinButton = script.Parent.RewardSpin.Button1
local Wheel = script.Parent.RewardSpin.Wheel

local spinTime = 3.5
local ElapsedTime = 0

function Spin()
	local Ores = Wheel.Ores
	for i = 1, 145 do
		ElapsedTime = ElapsedTime + 1
		print(ElapsedTime)
		print(i)
		wait(0.001)
		--Ores.Rotation = Ores.Rotation + 15
		if Ores.Rotation >= 1700 then
			Ores.Rotation = Ores.Rotation + 10	
		elseif Ores.Rotation >= 2000 then
			Ores.Rotation = Ores.Rotation + 5
		elseif Ores.Rotation >= 2100 then
			Ores.Rotation = Ores.Rotation + 2
		else
			Ores.Rotation += 15
		end
		
		if i == 360 then
			ElapsedTime = 0
			SpinButton.Visible = true
			break
		end
	end
	print("end")
	wait(3)
	SpinButton.Visible = true
	Ores.Rotation = 0
end

SpinButton.ImageButton.Activated:Connect(function()
	SpinButton.Visible = false
	Spin()
end)

A guy I was talking to said to set the speed of the rotation according to Sine function, this would probably be a good solution but I’m not sure how I could do that.

You should try tween the rotation, it looks like you are increasing rotation rather heavily, causing the “laggy” look.

2 Likes