Facebook
From aresbodur12, 1 Year ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 2426
  1. local par=script.Parent
  2.  
  3. local timer=par:WaitForChild'Timer'
  4. local timerlabel=timer:WaitForChild'Time'
  5. local timertitle=timer:WaitForChild'Title'
  6.  
  7. local SetTime = tick()
  8.  
  9. local RunService = game:GetService("RunService")
  10. -- edit this like 0 digit = 1, 1 digit = 1.0, 2 digit = 1.00 3 digit = 1.000 etc
  11. local RationalDigits = 2
  12.  
  13. function connectplrtouch(pt,func)
  14.         pt.Touched:Connect(function(t)
  15.                 local c=game.Players.LocalPlayer.Character
  16.                 if c and t:IsDescendantOf(c) then
  17.                         func()
  18.                 end
  19.         end)
  20. end
  21.  
  22. local timer_active=false
  23. local timer_time=0
  24.  
  25. local prev
  26. for _,d in pairs(workspace:GetDescendants()) do
  27.         if d.Name=='Timer_Start' then
  28.                 local name=(d:FindFirstChild'Title' and d.Title:IsA'StringValue' and d.Title.Value) or ''
  29.                 connectplrtouch(d,function()
  30.                         par.Enabled=true
  31.                         if prev~=d then
  32.                                 SetTime = tick()
  33.                                 prev=d
  34.                         end
  35.                         timertitle.Text=name
  36.                         timerlabel.TextColor3=Color3.new(1, 1, 1)
  37.                         SetTime = tick()
  38.                         timer_active=true
  39.                 end)
  40.         end
  41.         if d.Name=='Timer_Pause' then
  42.                 connectplrtouch(d,function()
  43.                         timerlabel.TextColor3=Color3.new(0, 1, 0)
  44.                         if timer_active == true then
  45.                                 game.ReplicatedStorage.ApplyTime:FireServer(timerlabel.Text)
  46.                         end
  47.                         timer_active=false
  48.                 end)
  49.         end
  50.         if d.Name=='Timer_Stop' then
  51.                 connectplrtouch(d,function()
  52.                         par.Enabled=false
  53.                         timerlabel.TextColor3=Color3.new(0, 1, 0)
  54.                         timer_active=false
  55.                         SetTime = tick()
  56.                 end)
  57.         end
  58. end
  59.  
  60. local Accuracy = 10^RationalDigits
  61. function TimerFunc()
  62.         if timer_active then
  63.  
  64.                 local Div1 = math.abs(tick() - SetTime)
  65.                 local CalculatedIncrement = math.round(Div1*Accuracy)/Accuracy
  66.                 local Addons={}
  67.                 for t=1,RationalDigits do
  68.                         local i = t-1
  69.                         local integer,predecimal = math.modf(CalculatedIncrement*(10^i))
  70.                         local decimal = predecimal/(10^i)
  71.                         if decimal == 0 then
  72.                                 Addons[t] = "0"
  73.                         end
  74.  
  75.                 end
  76.                 local NewText = tostring(CalculatedIncrement)
  77.                 for i,v in pairs(Addons) do
  78.                         NewText = NewText..v
  79.                 end
  80.                 timerlabel.Text=NewText
  81.  
  82.         end
  83. end
  84. while true do
  85.         wait(.025)
  86.         TimerFunc()
  87. end

Replies to Roblox Time Trial Gui Main rss

Title Name Language When
Re: Roblox Time Trial Gui Main Thundering Meerkat text 1 Year ago.
Re: Roblox Time Trial Gui Main Putrid Gibbon text 1 Year ago.
Re: Roblox Time Trial Gui Main Rude Teal text 1 Year ago.