Live event issue

I dont understand what i did wrong

local EventTime = 1682284560

local function startEvent()
	
	for _, player in pairs(game.Players:GetPlayers()) do
		
		game.ReplicatedStorage.RemoteEvents.LightningForce:FireClient(player)
		
	end
	
end

while true do
	
	local CurrentTime = os.time()
	
	if CurrentTime == EventTime then
		
		startEvent()
		
	end
	
	wait()
	
end

I’m not sure what is the problem here

You would want to check if the currentTime is greater than or equal to the live event time. This is done using the >= operator. The event you are checking for is 5 hours in the past, so it is not starting.

if CurrentTime >= EventTime then
	
	startEvent()
	
end
1 Like

how is it 5hrs in the past? i used this website https://www.epochconverter.com/

Ok, so you want it to check if it’s at an exact second for it to fire. I would suggest using math.floor(os.time()) to check if it’s in the exact second, because this value updates every heartbeat and in decimal numbers and almost impossible for it to be an integer so you must convert it to one. And also break the while loop when the event fires

os.time() will never return a decimal number, only an integer. However tick() will be in milliseconds and more exact

The timestamp in your code happened 5 hours ago (In UTC timezone)
image
For debugging, you can set EventTime to the current time + 10 seconds

local EventTime = os.time() + 10

local function startEvent()
	for _, player in pairs(game.Players:GetPlayers()) do
		print("fire")
	end
end

while task.wait() do
	local CurrentTime = os.time()
	if CurrentTime >= EventTime then
		print("start event")
		startEvent()
		break
	end
end

i just realized the website i sent is giving me incorrect time stamp i found another website rn and it works but thats wierd bc a yter like alvinblox used that website

Alternatively, you could just use the studio command bar to print the current timestamp
print(os.time())