My tasks reset when someone dies

I have 2 similer tasks in my game that are both bugged using the same scrcripting really.

But it suppose to wait 10 minutes then give you some rewards.

But when you die the counter rests.

local RemoteEvent = game.ReplicatedStorage.Task1
local Min = 60

function BeenMin(number)
	wait(Min)
	script.Parent.Text = number.."/10"
end

BeenMin(1)
BeenMin(2)
BeenMin(3)
BeenMin(4)
BeenMin(5)
BeenMin(6)
BeenMin(7)
BeenMin(8)
BeenMin(9)
BeenMin(10)
script.Parent.Parent.Task1.Text = "Completed!"
RemoteEvent:FireServer()

Wait() uses seconds, and most integer stuff do, so your’s is currently waiting for 60 seconds.

And the counter reset is not related to this script, where is this script located? (what’s the parent of it)

Bad practice too, this just runs all the functions at once.

1 Like

Why don’t you do something like this:

local RemoteEvent = game.ReplicatedStorage.Task1
local Min = 60
local number = 1

 repeat 
     wait(Min)
  	 script.Parent.Text = number.."/10"
     number += 1
  until number = 10


script.Parent.Parent.Task1.Text = "Completed!"
RemoteEvent:FireServer()
1 Like

turn off resetonspawn in the gui.

1 Like

If your script is a descendant of a ScreenGui, try disabling the “ResetOnSpawn” property on your ScreenGui.
Also, your script is a bit inefficient.

local RemoteEvent = game.ReplicatedStorage.Task1

for count = 1, 10 do -- Repeats the code below 10 times
wait(60)
script.Parent.Text = count.."/10"
end
--This part only runs when the loop above is completed.
script.Parent.Parent.Task1.Text = "Completed!"
RemoteEvent:FireServer()
1 Like

I literally am so dumb. lol

I forget about looping.