Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I track how long LocalPlayer has been playing in seconds and minutes?

Asked by 4 years ago
Edited 4 years ago

I want to track how long LocalPlayer has been playing in seconds and minutes. If you can, milliseconds too. Thanks. Put the time in a screengui, textlabel.

0
what about nanoseconds0 microsecond, ect iuclds 720 — 4y
0
@iuclds I don't want nanoseconds, microseconds, ect. GamingWithFlight 80 — 4y

1 answer

Log in to vote
1
Answered by
karlo_tr10 1233 Moderation Voter
4 years ago
local Player = game.Players.LocalPlayer
local Label = Player.PlayerGui:WaitForChild("ScreenGui").TextLabel
local InGame = 0
while true do
    InGame = InGame+1
    if InGame < 10 then
        Label.Text = "0:0"..tostring(InGame)
    else if InGame < 60 then
        Label.Text = "0:"..tostring(InGame)
    else if InGame >= 60 then   
                local minutes = math.floor(InGame/60)
                local sec = InGame-minutes*60
                if sec < 10  then
                    Label.Text = tostring(minutes)..":0"..tostring(sec)
                else
                    Label.Text = tostring(minutes)..":"..tostring(sec)
                end
            end
        end
    end
    wait(1)
end


Ad

Answer this question