using { /Fortnite.com/Devices } # This is our main "Controller" device. # It will sit in the world and listen for class selections. class ClassPickerController < creative_object: # We need a reference to the UI device we placed in the editor # Think of this as plugging a microphone into a speaker. selector_device: ClassSelectorUIDevice = ClassSelectorUIDevice{} # This function runs when the game starts OnBegin(): void = # 1. Listen for when a player selects a class selector_device.SelectedClassEvent += (player, selected_class) -> # 2. Do something with that selection HandleClassSelection(player, selected_class) # This is the "brain" that handles the logic HandleClassSelection(player: Player, class_name: string): void = # This is a simple if/else statement. # It's like checking the storm timer: if time > 0, storm is active. if class_name == "Hero": # Give the player a Shotgun # We use the 'Grant Item' device logic, but simplified for Verse # Note: In a real setup, you might use Item Granter devices linked to this script player.GrantWeapon(Shotgun{}) player.GrantItem(ShieldPotion{}) elif class_name == "Villain": # Give the player a Sniper player.GrantWeapon(SniperRifle{}) player.GrantItem(Cloak{}) else: # Default fallback if something goes wrong print("Player picked an unknown class. Giving them a fist.") player.GrantWeapon(Fist{})