This is a daily reward script with a timer. Every time the player leaves and rejoins the script resets. I tried implementing the on.time function myself but it didn't work. Can you help me?
local hr = 0 local min = 0 local sec = 0 local mic = 0 script.Parent.Parent.Claim.MouseButton1Click:connect(function() game.Workspace.ClickEvent:FireServer() game.ReplicatedStorage.button_click:Play() game.ReplicatedStorage.ding:Play() debounce = false if hr == 0 then hr = 24 script.Parent.Parent.Parent.Parent.Rain.Enabled = true wait(2) script.Parent.Parent.Parent.Parent.Rain.Enabled = false end wait(0.1) script.Parent.Parent.NotYet.Visible = true end) while wait() do mic = mic - 2 if mic <= -1 then sec = sec - 1 mic = 59 if sec == -1 then min = min - 1 sec = 59 if min == -1 then hr = hr - 1 min = 59 if hr == -1 then hr = 0 min = 0 sec = 0 mic = 0 end end end end if hr <= 9 and min <= 9 and sec <= 9 and mic <= 9 then script.Parent.Text = "0" ..hr.. ":0" ..min.. ":0" ..sec..":0" ..mic elseif hr <= 9 and min <= 9 and sec <= 9 and mic >= 10 then script.Parent.Text = "0" ..hr.. ":0" ..min.. ":0" ..sec..":" ..mic elseif hr <= 9 and min <= 9 and sec >= 10 and mic <= 9 then script.Parent.Text = "0" ..hr.. ":" ..min.. ":" ..sec..":0" ..mic elseif hr <= 10 and min >= 10 and sec >= 10 and mic >= 10 then script.Parent.Text = "0" ..hr.. ":" ..min.. ":" ..sec..":" ..mic elseif hr >= 10 and min <= 9 and sec <= 9 and mic <= 9 then script.Parent.Text = hr.. ":" ..min.. ":0" ..sec..":0" ..mic elseif hr >= 10 and min >= 10 and sec <= 9 and mic >= 10 then script.Parent.Text = hr.. ":" ..min.. ":0" ..sec..":" ..mic elseif hr >= 10 and min >= 10 and sec >= 10 and mic <= 9 then script.Parent.Text = hr.. ":" ..min.. ":" ..sec..":0" ..mic elseif hr >= 10 and min >= 10 and sec >= 10 and mic >= 10 then script.Parent.Text = hr.. ":" ..min.. ":" ..sec..":" ..mic end if hr == 0 and min == 0 and sec == 0 and mic == 0 then script.Parent.Parent.NotYet.Visible = false debounce = true end end
Marked as Duplicate by Amiaa16
This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.
Why was this question closed?