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

Help with tick()?

Asked by 10 years ago

Ok,for some reason script 1 works perfectly and Script 2 doesn't work perfectly ,why? The problem with Script 2 is that it displays that Gui's text with 389945:530. Please show how you manged to fix it.

Script 1:

while true do
    wait(.1)
--~--~--Varibles--~--~--~--~--
local ClientSeconds = tick()
Hour = math.floor(ClientSeconds/3600)
Minutes = math.floor(ClientSeconds/60%60)
Seconds = math.floor(ClientSeconds%60)
local TimeGui = script.Parent
local SecondsGui = script.Parent.Parent.Seconds
-------------Main Time Controller-------------
TimeGui.Text = Seconds
TimeGui.Text = Hour..":"..Minutes
wait(.1)
SecondsGui.Text = Seconds
TimeGui.Text = Hour.." "..Minutes
-----------------------------------------------
end

Tried removing those annoying spaces between second and minue 1- 9 and tried replacing them with the current second then 0 .

Example: Instead of it being 1 it will be 01

Script 2:

while true do
    wait(.1)
--~--~--Varibles--~--~--~--~--
local ClientSeconds = tick()
Hour = math.floor(ClientSeconds/3600)
Minutes = math.floor(ClientSeconds/60%60)
Seconds = math.floor(ClientSeconds%60)
local TimeGui = script.Parent
local SecondsGui = script.Parent.Parent.Seconds
------Removes the Space between Minutes-------
if Minutes == 0 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9
    then
    TimeGui.Text = Hour..":".. "0"..Minutes--Removes space in Minutes
else
    TimeGui.Text = Hour..":"..Minutes
------Removes the Space between Seconds-------
if Seconds == 0 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9
    then
    SecondsGui.Text ="0" ..Seconds --Removes Space In Seconds
else
    SecondsGui.Text = Seconds
-------------Main Time Controller-------------
TimeGui.Text = Seconds
TimeGui.Text = Hour..":"..Minutes
wait(.1)
SecondsGui.Text = Seconds
TimeGui.Text = Hour.." "..Minutes
-----------------------------------------------
end
end
end

1 answer

Log in to vote
1
Answered by
magnalite 198
10 years ago

if Minutes == 0 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 then

I'm afraid this is not how comparisons work. You need to treat every part separated by either "or" or "and" as its own little if statement. To do what you wanted to, you would need to do.

if Minutes == 0 or Minutes == 1 or Minutes == 2 or Minutes == 3 or Minutes == 4 or Minutes == 5 or Minutes == 6 or Minutes == 7 or 8 or Minutes == 9 then

Alternatively you can do.

if Minutes < 10 then

0
i'm still getting 389945:530 in thext. kevinnight45 550 — 10y
Ad

Answer this question