A modern, feature-rich dice rolling system for FiveM QBox servers with physical dice props, animated rolls, and stylish UI.
- ๐ฒ Physical Dice Props - Dice are thrown as physical objects with realistic physics
- ๐จ Modern NUI - Clean, styled UI with orange borders and black background
- ๐ 3D Attached UI - Results display above the physical dice in world space
- ๐ฌ Smooth Animations - Player performs throwing animation synced with dice spawn
- ๐ฅ Multiplayer Ready - All nearby players see dice rolls
- ๐ Distance-Based - Only visible within configurable range (default 7m)
- โ๏ธ Highly Configurable - Customize dice types, limits, props, display, and cooldowns
- ๐ฏ Item-Based Rolling - Use custom dice items with durability tracking
- ๐ฌ Command Support - Optional
/rollcommand with input dialog - ๐ Auto-Cleanup - Dice automatically despawn after configured time
- โฑ๏ธ Spam Protection - Configurable cooldown prevents roll spamming
- ๐ค Export Functions - Use dice items or open roll menu from other resources
- QBox Core (qbx_core)
- ox_lib
- ox_inventory
- Custom Dice Props by atenea03 - Optional but recommended for best visual quality
Place the brx_diceroll folder in your resources/[brx]/ directory
ensure brx_dicerollAdd dice items to ox_inventory/data/items.lua:
['diamond_dice'] = {
label = 'Diamond Dice',
weight = 50,
stack = false,
close = true,
consume = 0.05, -- 20 uses (1/20 = 0.05)
rarity = 'rare',
description = 'Rolls 2d6',
server = {
export = 'brx_diceroll.useDice',
},
},
['wooden_dice'] = {
label = 'Wooden Dice',
weight = 50,
stack = true,
close = true,
consume = 0.1, -- 10 uses
rarity = 'uncommon',
description = 'Rolls 1d6',
server = {
export = 'brx_diceroll.useDice',
},
},
['god_dice'] = {
label = 'God Dice',
weight = 50,
stack = false,
close = true,
consume = 0.01, -- 100 uses
rarity = 'legendary',
description = 'Rolls 1d100',
server = {
export = 'brx_diceroll.useDice',
},
},
--This dice opens the roll menu
['death_dice'] = {
label = 'Death Dice',
weight = 50,
stack = false,
close = true,
degrade = 1440, -- 24 hours
decay = true
rarity = 'Legendary',
description = 'Rolls customn sidded sided die',
server = {
export = 'brx_diceroll.openRollMenu',
},
},Edit config.lua to set default roll configurations:
Config.DiceDefaults = {
diamond_dice = { dices = 2, sides = 6 },
wooden_dice = { dices = 1, sides = 6 },
god_dice = { dices = 1, sides = 100 }
}Edit config.lua to customize behavior:
Config.Debug = false -- Enable debug printsConfig.DiceItems = {
'diamond_dice',
'wooden_dice',
'death_dice'
}Config.UseCommand = true -- Enable/disable /roll command
Config.ChatCommand = "roll" -- Command name
Config.RollCooldown = 3000 -- Cooldown between rolls in milliseconds (3000 = 3 seconds)Config.MinDices = 1 -- Minimum dice to roll
Config.MaxDices = 3 -- Maximum dice to roll Not Recommended to go over 5 since you are spawning props
Config.MinSides = 2 -- Minimum sides per die
Config.MaxSides = 1000 -- Maximum sides per dieConfig.MaxDistance = 7.0 -- Viewing distance in meters
Config.ShowTime = 10 -- Seconds that the UI will display the Results
Config.DiceProp = 'ate_dice_b' -- Dice prop model (ate_dice_a = oversized, ate_dice_b = normal)
Config.ThrowForce = 0.6 -- Physics force when throwing Recommend no more than 1.0
Config.DUIHeight = 0.3 -- UI height above dice (meters)This script uses custom optimized dice props by atenea03:
- Download: Get the dice props here
- Models:
ate_dice_a- Oversized dice (more visible) Goofy large but have funate_dice_b- Normal sized dice (recommended)
- Installation:
- Download and place the
ate_diceresource in your resources folder - Add
ensure ate_diceto your server.cfg beforeensure brx_diceroll
- Download and place the
Alternative Props: If you don't want to use custom props, you can use default GTA props:
prop_tennis_ball- Tennis ballhei_prop_heist_box- Small box- Any other small prop model
- Add dice items to your inventory
- Use the item from your inventory
- Watch the roll animation and see the results!
- Type
/rollin chat - Enter number of dice (1-3)
- Enter number of sides per die (2-1000)
- Watch the roll animation and see the results!
- Dice roll with realistic physics for 2 seconds before results show
- Results appear as UI elements floating above the physical dice props
- Only visible to players within 7 meters (configurable)
- Automatically disappear after ShowTime + 2 seconds (configurable)
- UI appears after dice settle for a natural feel
The UI is built with HTML/CSS and can be customized in web/dice-ui.html:
- Black background with 75% opacity
- Orange (#ffa500) borders
- 18px white text with shadow
- Rounded corners (8px)
- Centered above dice props
Edit the .dice-ui class in dice-ui.html to change:
- Background color/opacity
- Border color/thickness
- Font size/style
- Padding/sizing
- Border radius
- Player triggers roll (via item or command)
- Cooldown check (prevents spam within configured time)
- Animation plays
- Dice spawn at 1.8s (during throwing motion for natural feel)
- Server generates results (random numbers based on dice config)
- Physical dice roll (client-side props with physics for 2 seconds)
- UI displays results (appears after dice settle)
- Auto-cleanup (dice and UI removed after ShowTime + 2s)
- Results: Server-synced for all players (everyone sees the same numbers)
- Dice Physics: Client-side spawning for smooth performance (slight visual variation is normal)
- Roller: Sees dice immediately with full physics
- Nearby players: See dice spawn at the same location with same results
- Distance check: Only visible within MaxDistance range
- Dice are spawned client-side for optimal performance (no networking delays or freezes)
- Server sends roll results and coordinates to all nearby players
- Each client independently spawns dice at the same position
- Result numbers are server-synced and identical for all players
- Efficient render loop using World3dToScreen2d
- Distance checks to hide UI when too far
- Automatic cleanup prevents entity buildup
- Configurable cooldown prevents spam and animation overlap
ox_libfor animations, models, and input dialogsox_inventoryfor item system and durabilityqbx_corefor player data and character info
- Ensure
Config.DicePropis a valid prop model - Check F8 console for model loading errors
- Verify ate_dice resource is started if using Athena's Dice prop
- Make sure animation dictionary loads successfully
- Check F8 console for any errors
- Verify ox_lib is installed and updated
- Verify
server.exportis set correctly in ox_inventory items.lua- Use
brx_diceroll.useDicefor auto-roll items - Use
brx_diceroll.openRollMenufor menu items
- Use
- Ensure dice item names match
Config.DiceItems - Check
Config.DiceDefaultshas entries for your items
Use in item configuration to automatically roll with predefined settings:
server = {
export = 'brx_diceroll.useDice',
}Use in item configuration to open the roll menu dialog:
server = {
export = 'brx_diceroll.openRollMenu',
}Author: BruiserX
Framework: QBox
Dice Props: atenea03 - Custom Dice Models
Version: 1.1.0
License: MIT
- atenea03 - For the custom optimized dice prop models (150 polygons, 2 models)