# Import the basic Verse framework
using /Fortnite.com/Devices
using /Verse.org/Simulation
using /Verse.org/Random
# This script attaches to an Item Granter device
slap_spawner := class(creative_device):
# This is the "Inventory Slot" for our script.
# It holds a reference to the Item Granter device placed on your island.
# Wire this up in the UEFN editor by selecting the device in the Details panel.
@editable
MyGranter : item_granter_device = item_granter_device{}
# This is a second Item Granter used as the re-grant source.
# Configure it in the UEFN editor to hold a Slap Berry, Reset on Grant = true.
# When GrantItem() is called on it, it fires its configured item at the player.
@editable
MyRespawnGranter : item_granter_device = item_granter_device{}
# OnBegin runs once when the game starts.
# We use it to subscribe to the granter's ItemGrantedEvent so we
# react every time the granter gives an item to a player.
OnBegin<override>()<suspends> : void =
# Subscribe: whenever MyGranter grants an item, call our respawn function.
MyGranter.ItemGrantedEvent.Subscribe(HandleSlapGranted)
# This function fires each time MyGranter grants its item to a player.
# 'GrantingPlayer' is whoever received the item.
HandleSlapGranted(GrantingPlayer : player) : void =
Verse Library
verse
01 Device
Listens for item grants and instantly re-grants Slap items to players for infinite combat loop.
verse-library/using-slap-consumables-in-fortnite-creative/01-device.verse
Sign in free to read the full source 🌴
This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.