I'm creating a code that will check your reaction speed. If you click the button a for loop will stop and tell your reaction speed, but when I click it and no matter how much time I wait, it still just displays 0. Is there any way to fix this?
The code is in a LocalScript in the TextButton.
Code:
wait(2)
print("ready to go")
local playergui = game.Players.LocalPlayer.PlayerGui
local TextButton = playergui.ScreenGui.TextButton
local randomtime = math.random(2,4)
wait(randomtime)
TextButton.BackgroundColor3 = Color3.new(0,225,0)
TextButton.Text = "Click!"
TextButton.Activated:Connect(function(activated)
for i = 0, math.huge, 1 do
wait()
if activated then
TextButton.Text = (i)
break
end
end
end)
