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!