local Timer = script.Parent.Timer
local time = 0
local Button = script.Parent.Button
Button.MouseButton1Click:Connect(function()
while true do
wait(1)
time = time + 1
print(time)
end
end)
Timer.Text = time
time.Changed:Connect(function()
Timer.Text = time
end)
✓ ANSWER ACCEPTED
how to fix this display timer in a localscript?
2 answers
✓ Accepted answer
You're overcomplicating it:
local Timer = script.Parent.Timer
local time = 0
local Button = script.Parent.Button
Button.MouseButton1Click:Connect(function()
while true do
wait(1)
time = time + 1
Timer.Text = tostring(time) --// You don't have to put the tostring there, it's just a precaution
end
end)
Timer.Text = time
local Timer = script.Parent.Timer
local time = 0
local Button = script.Parent.Button
Button.MouseButton1Click:Connect(function()
while wait(1) do
time = time + 1
Timer.Text = time
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
