BedWars Creative
  • 📜Changelog
  • ðŸŽĻSandbox Mode
  • 🊓WorldEdit Commands
  • ðŸ›ĄïļWorldGuard System
  • 🍊BedWars Scripting
    • 🚜Services
      • ðŸŽ―AbilityService
      • ðŸ“ĢAnnouncementService
      • ðŸ§ąBlockService
      • ðŸ”ĪChatService
      • ⚔ïļCombatService
      • 🌊ïļDisasterService
      • 🊅DataStoreService
      • ðŸŠĻEntityService
      • ðŸ”ĨForgeService
      • 🏭GeneratorService
      • ðŸ‘Đ‍🚀GravityService
      • âŒĻïļInputService
      • 🎒InventoryService
      • 💎ItemService
      • 🛏ïļMatchService
      • â„đïļMessageService
      • 🎁ModelService
      • ðŸĶĪMountService
      • 🏄‍♂ïļPlayerService
      • 🏗ïļPartService
      • 🎉ParticleService
      • 👆PromptService
      • 💰ShopService
      • ðŸ“ŧSoundService
      • 🊄StatusEffectService
      • 🚁VehicleService
      • ðŸšĐTeamService
      • ðŸĨ‡UIService
    • ðŸĪEvents
      • BeforeProjectileLaunched
      • BlockPlace
      • BlockBreak
      • BedAlarmTriggered
      • ConsumeItem
      • Enchant
      • EntityDamage
      • EntityDeath
      • EntitySpawn
      • Forged
      • InventoryItemAdded
      • ItemPurchase
      • MatchStart
      • PlayerChatted
      • PlayerAdded
      • PlayerRemoving
      • PlayerDropItem
      • PlayerPickupItem
      • ProjectileLaunched
      • ProjectileHit
      • StatusEffectAdded
      • StatusEffectRemoved
      • WeaponSwing
      • TeamUpgradePurchased
      • TeamUpgradeEraPurchased
      • Telepearled
      • UseAbility
    • ðŸ“ĶObjects
      • AbilityConfig
      • Block
      • Entity
        • ImageEntity
        • KitEntity
        • CreatureEntity
      • Generator
      • Knockback
      • Leaderboard
      • MatchState
      • Model
      • ParticleEmitter
      • Part
      • Player
      • Prompt
      • ProgressBar
      • TextLabel
      • Team
    • 📚Types
      • AbilityType
      • AbilityInputType
      • CreatureType
      • DisasterType
      • EnchantType
      • ItemType
      • KitType
      • ModelType
      • MountType
      • VehicleType
      • ProjectileType
      • SoundType
      • StatusEffectType
      • TeamUpgradeEraType
      • TeamUpgradeType
      • MatchRole
    • ⚙ïļUtilities
      • require
      • math
      • pairs & ipairs
      • print & error
      • os
      • string
      • table
      • task
      • tick
      • tostring & tonumber
      • wait
Powered by GitBook
On this page
  1. BedWars Scripting
  2. Services

UIService

Service for creating in-game UI.

PreviousTeamServiceNextEvents

Last updated 1 year ago

Functions

createProgressBar(maxProgress: number):

Creates a progress bar with the given maximum progress value. By default, progress bars are displayed globally, but the list of players who are able to view the progress bar can be configured.

Example usage:

local diamondBar = UIService.createProgressBar(10)
diamondBar:setColor(Color3.fromRGB(0, 179, 179))

local emeraldBar = UIService.createProgressBar(15)
emeraldBar:setColor(Color3.fromRGB(80, 200, 120))

Events.InventoryItemAdded(function(event)
    if (event.item == ItemType.DIAMOND) then
        diamondBar:add(event.amount)
    end    
    if (event.item == ItemType.EMERALD) then
        emeraldBar:add(event.amount)
    end
end)

createLeaderboard():

Example usage of a Leaderboard that displays strings:

local board = UIService.createLeaderboard()

board:addKey('Blue')
board:addKey('Pink')

Events.BlockPlace(function(event)
    if (event.blockType == ItemType.WOOL_PINK) then
        board:addScore('Pink', 1)
    end
    if (event.blockType == ItemType.WOOL_BLUE) then
        board:addScore('Blue', 1)
    end
end)

Example usage:

-- Create a text label above all Slime Blocks
local slimeBlocks = BlockService.getAllBlocks({ ItemType.SLIME_BLOCK })

for i, block in ipairs(slimeBlocks) do
    local positionAbove = block.position + Vector3.new(0, 6, 0)
    local label = UIService.createTextLabel("Gloop's House", positionAbove)

    label:setBackgroundColor(Color3.fromRGB(126, 255, 103))
    label:setBackgroundTransparency(0.2)
    label:setTextColor(Color3.fromRGB(0,0,0))
    label:setSize(UDim2.fromScale(10,2))
    label:setFont(Font.LuckiestGuy)
end

Creates a that is displayed for all players. A custom game can only have one leaderboard at any given time. Leaderboards can have entries of , , or strings.

createTextLabel(text: string, position: ):

Creates a that is displayed in-world.

🍊
🚜
ðŸĨ‡
ProgressBar
Leaderboard
Leaderboard
Players
Teams
Vector3
TextLabel
TextLabel