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

How do I turn a IntValue into hours and seconds?

Asked by
Vxpper 101
4 years ago

I'm stuck on how to turn the IntValue that has a value of 86400(seconds in a day). How do I turn the value into Hours and seconds? I have checked online the wiki and haven't been able to find anything to answer my question. Please, if possible give me some help

local plr = game.Players.LocalPlayer
local hasjoined = plr.hasjoined
local val = script.Parent.Timer
local sp = script.Parent.Parent.Parent.StarterPack
local repstore = game:GetService("ReplicatedStorage") 
local rem = repstore.RemoteFolder:WaitForChild("StarterPackUpdate")

if hasjoined.Value == false then
    while wait(1) do
    val.Value = val.Value - 1
    script.Parent.Text = "".. val.Value ..""

    if val.Value == 0 then
        sp.Visible = false
        rem:FireServer("updateSP")
        print("fired")
elseif
        hasjoined.Value == true then
        sp.Visible = false
end
end
end
3
script.Parent.Text = string.format("%d: % 0 2 d", math.floor(val.Value/60), val.Value%60) User#24403 69 — 4y
0
Be sure to remove the space in the pattern % 0 2 d. I put them there since the site doesn't like them for some reason User#24403 69 — 4y
0
Sorry to ask, is there a way to make it Hours,Minutes,Seconds? Vxpper 101 — 4y
1
ew what indentation is that LoganboyInCO 150 — 4y
View all comments (2 more)
0
I don't worry about indentation I fix it when I'm done with a script not when I'm working on it Vxpper 101 — 4y
0
Why do indentation after you finish? The point of it is to be easier to read. ForeverBrown 356 — 4y

Answer this question