Why We Use TypeScript Instead of Luau
This week's episode of Beyond The Blox is a solo one. With both Fedor and Anthony unavailable, I took the opportunity to talk through something technical that's made a huge difference to how I build games at Last Level Studios: switching from native Luau to TypeScript using Roblox-TS.
Last year I completely rewrote our 10-pin bowling arcade game, The Lanes, to eliminate bugs and make it easier to scale. We didn't just rewrite the features; we switched our entire programming language. Here's why.
Watch the full episode on YouTube
Type Safety: No More "Attempt to index nil"
If you've spent any time scripting on Roblox, you'll have seen the classic "attempt to index nil" error. Your code isn't pointing at the instance you thought it was, or a value you expected to be text turned out to be a number. It's incredibly common.
Coming from an engineering background, I have a very low tolerance for "maybe." TypeScript is built around the fundamental problem that JavaScript didn't have strict typing or a built-in type checker, and Luau has the same issue. Both use a fluid system where variables can be reassigned to different types without enforcement.
Roblox knows this has been a problem. Luau now has a typing system, and Roblox even overhauled the type solver just a few months ago, but it's still finding its feet compared to TypeScript, a battle-tested industry standard with over a decade of refinement behind it.
TypeScript is essentially a contract. You define the rules of your data upfront and the compiler refuses to let you break them before the code even reaches Roblox. I'm catching those "attempt to index nil" bugs in my editor, not in a live game with 50 players wondering why their bowling ball disappeared.
The Ecosystem Advantage
Professional development is all about dependencies, not reinventing the wheel. In the TypeScript world, we have npm: if a solution exists, it's there, it's versioned, and your editor handles it automatically. The Roblox-TS community maintains a dedicated set of packages on npm that provide typed bindings and utilities purpose-built for the platform.
In the Luau world, it still feels like a scavenger hunt. You're browsing the Creator Store, random GitHub repos, or DevForum posts, shifting between package managers like Wally or RoStrap. There's no single "town square" for all the code to live.
Even AI coding tools perform significantly better with TypeScript. Tools like Windsurf, which I use as a coding assistant, have billions of lines of TypeScript training data to pull from, making them far more reliable than when working with the more niche syntax of Luau.
JSX: A Game Changer for UI
Building UI on Roblox can be a nightmare. Most people design it in Studio and then write endless lines of code to find and update individual elements. Having a background in web development, I was desperate for something more intuitive.
JSX lets you define your UI in a hierarchical structure that looks like HTML but acts like code. Combined with React, which Roblox ported from the web development world, it's insanely powerful. For The Lanes, this turned our complex interface from a headache into a dream.
The Trade-Offs
It's not all sunshine and rainbows. You lose the ability to edit scripts directly in Roblox Studio and need an external editor with a file sync tool like Rojo. Tracing runtime errors back to your TypeScript source can take detective work since line numbers don't map one-to-one. And because Roblox-TS is a community project, certain APIs can lag behind the very latest Roblox updates, though the open-source nature means you can fix issues yourself and contribute back.
Is It Worth It?
For me, absolutely. The speed and confidence I get from type safety and JSX far outweigh the friction of using external tools. I'm using Roblox-TS for all my new projects, including the 72-hour Game Jam I did back in February. If you want to try it, head to roblox-ts.com. Or if this episode convinced you to double down on native Luau, check out luau.org to see how Roblox is bringing some of that TypeScript magic directly into the language.
Sources: