If you’ve seen scripts labeled “91” in Roblox Studio especially ones that show custom buttons, health bars, or inventory panels you’re likely trying to understand how roblox how to 91 scripting with custom UI actually works. It’s not a special version of Roblox Lua or an official feature. “91” is just a common naming convention developers use for local scripts that handle UI logic like updating text labels when a player picks up coins or fading in a menu after respawn. The number itself doesn’t do anything; it’s the script’s placement, scope, and behavior that matter.

What does “91 scripting with custom UI” actually mean?

“91 scripting” refers to placing a LocalScript inside StarterPlayerScripts (or sometimes StarterPlayer.StarterPlayerScripts) and naming it something like 91_UIHandler or 91_HUD. It’s shorthand not syntax for “this script runs only for the local player and manages UI elements.” Custom UI means things like animated frames, draggable toolbars, or real-time stat displays built with ScreenGui, TextButton, or ImageLabel objects. You’ll see this pattern used in games where players need responsive, client-side feedback without waiting for server confirmation like showing ammo count as you reload or highlighting interactable objects.

When would you use a 91-style local script for UI?

You’d use it when the UI needs to react instantly to player input or local state no network delay, no server round-trip. For example: a sprint stamina bar that depletes while holding Shift, a minimap that rotates with the camera, or a chat bubble that appears above your character’s head when typing. These don’t require server validation, so they belong in a LocalScript not a Script inside ServerScriptService. If you’re building something like that and want it to feel smooth and responsive, this is the right place to start. You can learn more about how these scripts differ from others in our guide on how to use local scripts for UI logic.

How do you set it up step by step?

First, make sure your UI is in StarterPlayer.StarterPlayerGui (not StarterGui), so it loads for each player. Then insert a LocalScript there and name it something clear like 91_InventoryUI. Inside, use game.Players.LocalPlayer to get the current player, then find your UI elements using script.Parent:WaitForChild("InventoryFrame"). Connect events like KeyDown or CharacterAdded to update visibility or values. Avoid putting heavy loops or remote calls directly in the script those belong in separate modules or server scripts. If you're new to this flow, check out the beginner-friendly walkthrough that walks through naming, placement, and basic connections.

What mistakes do people make with 91 UI scripts?

A common mistake is parenting UI elements directly to the LocalScript like dragging a TextLabel into the script in Explorer. That breaks the hierarchy and makes the UI invisible. Another is forgetting to use StarterPlayer.StarterPlayerGui instead of StarterGui, which causes the UI to appear for all players (including other people’s characters) or not load at all. Also, some try to change properties of Workspace objects like moving parts or changing colors from a LocalScript. That won’t work unless you use a RemoteEvent or RemoteFunction to ask the server. Stick to UI updates and local data only.

What’s a simple working example?

Here’s a minimal but functional setup: create a ScreenGui named HUD inside StarterPlayer.StarterPlayerGui, then add a TextLabel called HealthText. In your 91_HUDUpdater LocalScript:

  • Use local player = game.Players.LocalPlayer
  • Get the label with local healthLabel = script.Parent.HUD.HealthText
  • Connect to player.Character.Humanoid.HealthChanged to update the text
  • Set healthLabel.Text = "HP: " .. player.Character.Humanoid.Health

This runs only for that player, updates instantly, and stays scoped correctly. No extra libraries or frameworks needed.

Where should you go next?

If you’ve got a working 91 UI script but want it to respond to server events like showing a “You died!” message after the server confirms death add a RemoteEvent and connect its OnClientEvent in the same LocalScript. If your UI feels sluggish, check whether you’re updating too many properties every frame (use Heartbeat sparingly) or loading assets repeatedly (cache images or fonts once). And if you’re ready to organize larger projects, consider moving repeated UI logic into ModuleScripts inside ReplicatedStorage and requiring them in your 91 scripts. For deeper structure ideas, see our page on structuring custom UI with consistent naming and scope.

Before publishing: test with multiple players in Studio’s Test tab, verify UI shows only for the correct player, and confirm no errors appear in the Output window when interacting. If something doesn’t update, double-check parent paths and whether the Humanoid or Character exists before trying to access it.