Need help with a script

How would i make it so this code will count down to May 2 2022 at 10Am PST?

local newYear = os.time({year = os.date("%Y", os.time() + (365*24*60*60) - (24*60*60)), month = 5, day = 2})


while wait(1) do
	
	local currentTime = os.time()
	
	local timeDiff = newYear - currentTime
	
	
	local d = math.floor(timeDiff/60/60/24)
	local h = string.format("%0.2i", math.floor((timeDiff - (d*60*60*24))/60/60))
	local m = string.format("%0.2i", math.floor((timeDiff - (d*60*60*24) - (h*60*60))/60))
	local s = string.format("%0.2i", timeDiff - (d*60*60*24) - (h*60*60) - (m*60))
	local formattedTime = d .. ":" .. h .. ":" .. m .. ":" .. s
	
	script.Parent.Clock.ClockGui.TimeToNewYear.Text = timeDiff <= 0 and "00:00:00:00" or formattedTime
	
	if timeDiff <= 0 then

		break
	end
end


for i = 1, 100 do
	
	for x = 1, math.random(2, 7) do
		
		spawn(function()
			
			local firework = script.Firework:Clone()
			firework.Parent = workspace
			
			local cf = CFrame.new(
				Vector3.new(
					math.random(script.Parent.FireworkSpawn.Position.X - script.Parent.FireworkSpawn.Size.X/2, script.Parent.FireworkSpawn.Position.X + script.Parent.FireworkSpawn.Size.X/2), 
					script.Parent.FireworkSpawn.Position.Y + firework.Size.Y/2, 
					math.random(script.Parent.FireworkSpawn.Position.Z - script.Parent.FireworkSpawn.Size.Z/2, script.Parent.FireworkSpawn.Position.Z + script.Parent.FireworkSpawn.Size.Z/2)),
				Vector3.new(
					0,
					math.random(0, 360),
					0))
			
			firework.CFrame = cf
			
			firework.Transparency = 0
			
			firework.Velocity = Vector3.new(0, 200, 0)
			
			firework.Anchored = false
			
			firework.LaunchSound:Play()
			
			repeat wait() until firework.Velocity.Magnitude <= 30
			
			firework.Anchored = true
			firework.Transparency = 1
			
			firework.FireworkParticles.Enabled = true
			
			firework.ExplodeSound:Play()
			
			game:GetService("Debris"):AddItem(firework, 2)
		end)
		
		wait(math.random(10)/10)
	end
	
	wait(math.random(1, 3))
end
1 Like

Use this and multiply the result

1 Like

All i got was 1651485600, i used this code: print(os.time{year=2022, month=5, day=2, hour=10, sec=0}) i got the code from here: Programming in Lua : 22.1

1 Like

Okay then

local Result = 1651485600 -- os.difftime...etc

local Seconds = Result
local Minutes = Seconds / 60
local Hours = Minutes / 60
local Days = Hours / 24
local Months = Days / 32 -- Take note months have diff days
local Years = Months  / 12 -- Useful?
1 Like

Do i just print all this and that will be my answer or is the the local d = math.floor(timeDiff/60/60/24)
local h = string.format("%0.2i", math.floor((timeDiff - (d606024))/60/60))
local m = string.format("%0.2i", math.floor((timeDiff - (d
606024) - (h6060))/60))
local s = string.format("%0.2i", timeDiff - (d606024) - (h6060) - (m60))
local formattedTime = d … “:” … h … “:” … m … “:” … s
Code?

1 Like

Yes print it and use a repeat wait (1) until d == 0 and h == 0 and etc

1 Like