How to know when an event is active


How would I go about knowing whether or not an event is active?
an example is a 2x xp weekend event and knowing whether the event is active or not to know if the player should get 2x xp

2 Likes

there is no api or web endpoint as of now to check if an event is active.

i recommend that you set up the timestamps of when your event is going to run before starting the event. that’s probably the closest you will get until roblox adds an api for event checking.

The following API is used on the Roblox website to return the events of a game:

https://apis.roblox.com/virtual-events/v1/universes/{universeId}/virtual-events

This API returns a JSON encoded table and the events are inside the data field. The events have a field named eventStatus that is set to active, however this is also true for upcoming events of a game(for example events that will happen in two days from now). This API does return when an event is supposed to be active and when it is supposed to end inside the eventTime field which has two subfields startUtc and endUtc, which hold time values as strings in UTC format(for example 2025-08-08T15:00:00+00:00).

In Roblox, you can convert the above date string to seconds like this:

local function utcStringToSeconds(utcString: string): number?
	local dt = DateTime.fromIsoDate(utcString)
	if not dt then return nil end 
	return dt.UnixTimestamp 
end

Then all you have to do is compare it to the response of workspace:GetServerTimeNow() and if the condition eventStart <= currentServerTime <= eventEnd is true give the event perks.

Also worth noting that you don’t need to make any API calls for the universe id if it isn’t dynamic. If you know it before hand you can hardcode it in as a constant, and if the universe id is that of the game running the code, it’s already stored inside game.GameId.

Every event also has a constant id field which you can use as a unique identifier and map to specific in-game perks(like you do with other things like badges and gamepasses).

1 Like

man i didnt even know that was an api yet.
you gotta use a proxy tho

I believe there IS an API for this.
SocialService | Documentation - Roblox Creator Hub