FastFlag - Luau implementation of FastFlags

FastFlag

FastFlags made easy

About

FastFlag is a modern open-source Roblox Luau module that brings FastFlags to Roblox. It allows you to make changes to any implemented state inside of live production code without publishing any changes. When you change FastFlag’s value, it will immediately update the given FastFlag in every running server and will persist indefinitely.

Installation

Roblox Module ← https://create.roblox.com/marketplace/asset/12672828808/

Use Cases

  • Enable or disable certain feature in your game.
  • Whether system that relies on real world forecast data, updated in real-time.

License

MIT

Closing

Example

local showCubeFlag = FastFlag.new("ShowCube", false)

local function updateCube(visible: boolean)
	script.Parent.Transparency = if visible == true then 0 else 1
end

updateCube(showCubeFlag.Value)
showCubeFlag.Changed:Connect(updateCube)
Documentation

Creating a FastFlag

FastFlag.new(name, defaultValue)

Properties of FastFlag

fastFlag.Name
fastFlag.Value
fastFlag.Changed

Listening to Changes

fastFlag.Changed:Connect(function(newValue)

end)

Disconnecting FastFlag

fastFlag:Disconnect()

Interacting with FastFlags

You can use this simple TypeScript class to interact with FastFlags.

// Remove "npm:" from import statement if you are not using Deno runtime
import { Universe, DataStore } from "npm:@daw588/roblox.js";

export default class FastFlags {
	private static NAMESPACE = "FastFlags";

	private universe: Universe;

	private fastFlagsStore: DataStore;

	public constructor(experienceId: number, apiKey: string) {
		this.universe = new Universe(experienceId, apiKey);
		this.fastFlagsStore = new DataStore(this.universe, FastFlags.NAMESPACE);
	}

	public async set<T>(name: string, value: T) {
		await this.fastFlagsStore.SetAsync<T>(name, value);
		await this.universe.PublishMessageAsync(FastFlags.NAMESPACE, JSON.stringify({
			name,
			value
		}));
	}
}
import FastFlags from "./fastflags.ts";

const fastFlags = new FastFlags(
	0000000, // Experience Id
	"" // OpenCloud API Key
);

fastFlags.set<boolean>("ShowCube", false);
13 Likes

Interesting concept you have here, I can see this being useful in beta games, where you could easily flip fast flags for buggy features, etc.

3 Likes
	script.Parent.Transparency = visible and 0 or 1

Can you give more explanation about “FastFlag” if possible?

May be this could be also used for live events?

FastFlag allows you to modify its value on the go while live in game. The cube example was showing me playing a live game of mine where I later on updated the FastFlag to false externally using JavaScript, where cube reacted to the FastFlag change by disappearing without me restarting the server.

You can think of it as a variable that you can change at anytime outside of Roblox that synchronizes across all of your running servers.

Yes, that’s also another use case, you can use FastFlags for pretty much anything that you want to update outside of Roblox without restarting the servers, it’s all synchronized real-time :upside_down_face:

Aha, that makes much more sense now, thanks for the small explanation! Pretty neat idea!

1 Like

how do I setup the module at the typescript

It dosent have typings for roblox-ts. You can’t set it up with rbxts until it gets one.

Yeah, it doesn’t have roblox-ts typings, if anyone wants to contribute let me know, I will create GitHub repository.

How fast is this compared to a makeshift websocket with similar features? and what’s the main difference?

I think you’re confused with what I mean, I asked how do I setup the TypeScript provided, not how to set it up with roblox-ts

Roblox-ts is ts for roblox. its the only way to use typescript in roblox so far. No, this resource isnt in ts. If it was it would get taken down.

If you meant “how to put this in roblox” You will need rojo + roblox-ts + git

You can use a JavaScript runtime, like Node.js, Deno, bun.js, etc. For Node.js you will have to transpile TypeScript to JavaScript, or simply remove types and run plain JavaScript.

1 Like