I have an issue with a timing minigames which i dont quite to understand

I have recently stumbled upon an issue with my timing minigame i cant cant really understand what is the cause or how i can exactly fix it.

the timing shown in the video is off by quite a big amount and i am not aware whats causing the problem.

I have tried analizing the code and the video but i cant understand whats causing the problem.

Heres the code used for the minigame:

local treshold = 0.3
local timer = 2.5
local randomSize = math.random(10,30) / 10

local startTick = tick()

local currentCombo = 1

RunService.RenderStepped:Connect(function()
	OuterCircle.Size = UDim2.new((1 - (tick() - startTick) / timer) * 0.35, 0, (1 - (tick() - startTick) / timer) * 0.35, 0)
	
	
	InnerCircle.Size = UDim2.new((3.5 - randomSize) / 10, 0, (3.5 - randomSize) / 10, 0)
	
	script.Parent.Label1.Text = randomSize - treshold / 2
	script.Parent.Label2.Text = tick() - startTick
	script.Parent.Label3.Text = randomSize + treshold / 2
	
	if tick() - startTick > timer then
		startTick = tick()
		currentCombo = 1
		randomSize = math.random(10,30) / 10
		
		Indicator.Text = "combo: x1"
	end
end)

UserInputService.InputBegan:Connect(function(key, processed)
	if processed then
		return
	end
	
	if key.UserInputType == Enum.UserInputType.MouseButton1 then
		randomSize = math.random(10,30) / 10

		
		if randomSize - treshold / 2 <= tick() - startTick and randomSize + treshold / 2 >= tick() - startTick then
			currentCombo += 1
			
			Indicator.Text = "combo: x"..tostring(currentCombo)
		else
			currentCombo = 1
			
			Indicator.Text = "combo: x1"
		end
		
		startTick = tick()
	end
end)

I appreciate any type of help!

Hi @SiperStrengh35974

Instructions is not quite understandable but i think problem is with not rounded decimal numbers.

I quoted part that should be changed.

Full Script:

change RN to number of decimals how much you want:

local treshold = 0.3
local timer = 2.5
local randomSize = math.random(10,30) / 10

local startTick = tick()

local currentCombo = 1

local RN = 2

function Number_Round(value)
	local multiplier = 10 ^ RN
	local rounded_value = math.floor(value * multiplier + 0.5) / multiplier

	return rounded_value
end

RunService.RenderStepped:Connect(function()
	OuterCircle.Size = UDim2.new((1 - (tick() - startTick) / timer) * 0.35, 0, (1 - (tick() - startTick) / timer) * 0.35, 0)


	InnerCircle.Size = UDim2.new((3.5 - randomSize) / 10, 0, (3.5 - randomSize) / 10, 0)

	script.Parent.Label1.Text = Number_Round(randomSize - treshold / 2)
	script.Parent.Label2.Text = Number_Round(tick() - startTick)
	script.Parent.Label3.Text = Number_Round(randomSize + treshold / 2)

	if tick() - startTick > timer then
		startTick = tick()
		currentCombo = 1
		randomSize = math.random(10,30) / 10

		Indicator.Text = "combo: x1"
	end
end)

UserInputService.InputBegan:Connect(function(key, processed)
	if processed then
		return
	end

	if key.UserInputType == Enum.UserInputType.MouseButton1 then
		randomSize = math.random(10,30) / 10


		if randomSize - treshold / 2 <= tick() - startTick and randomSize + treshold / 2 >= tick() - startTick then
			currentCombo += 1

			Indicator.Text = "combo: x"..tostring(currentCombo)
		else
			currentCombo = 1

			Indicator.Text = "combo: x1"
		end

		startTick = tick()
	end
end)