using { /Fortnite.com/Devices } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # This is our main script. # It controls the garage. MyGarageDevice := class(creative_device): # This is the spawner. # It will make the car appear. # note: Assign this device reference in the UEFN details panel after adding the Verse device to your island. @editable car_spawner : sports_car_spawner_device = sports_car_spawner_device{} # This is the trigger. # It detects when a player steps on it. # note: Assign this device reference in the UEFN details panel after adding the Verse device to your island. @editable start_button : trigger_device = trigger_device{} # This function runs when the game starts. OnBegin() : void = # We listen for the button press. # When the button is pressed, we call "OnButtonPressed". start_button.TriggeredEvent.Subscribe(OnButtonPressed) # This function makes the car appear. OnButtonPressed(agent : agent) : void = # We check that the agent is a player before spawning. if (player := player[agent]): # This line tells the spawner to spawn a car. # It uses the player's chosen car skin. car_spawner.SpawnVehicleFor(player)