How would I be able to modify this script so that it can get the final time and save it?
local par=script.Parent
local timer=par:WaitForChild'Timer'
local timerlabel=timer:WaitForChild'Time'
local timertitle=timer:WaitForChild'Title'
function connectplrtouch(pt,func)
pt.Touched:Connect(function(t)
local c=game.Players.LocalPlayer.Character
if c and t:IsDescendantOf(c) then
func()
end
end)
end
local timer_active=false
local timer_time=0
local prev
for _,d in pairs(workspace:GetDescendants()) do
if d.Name=='Timer_Start' then
local name=(d:FindFirstChild'Title' and d.Title:IsA'StringValue' and d.Title.Value) or ''
connectplrtouch(d,function()
par.Enabled=true
if prev~=d then
timer_time=0
prev=d
end
timertitle.Text=name
timerlabel.TextColor3=Color3.new(1,1,1)
timer_active=true
end)
end
if d.Name=='Timer_Pause' then
connectplrtouch(d,function()
timer_active=false
end)
end
if d.Name=='Timer_Stop' then
connectplrtouch(d,function()
-- par.Enabled=false
timerlabel.TextColor3=Color3.new(0.51339, 1, 0.202167)
timer_active=false
timer_time=0
end)
end
end
while wait(.1) do
if timer_active then
timer_time=timer_time+1
local txt=math.floor(timer_time)/10
local int,dec=math.modf(txt)
if dec<.09 then txt=(txt..'.0')end
timerlabel.Text=txt
end
end