# Rare Heal Station — only the OnButtonPressed handler changes.
# All using{} imports and the class header stay the same as above.
OnButtonPressed(Agent : agent) : void =
# Roll a 4-sided die. GetRandomInt is from /Verse.org/Random.
Roll := GetRandomInt(1, 4)
# Only grant the item on a roll of 1 (25% chance).
if (Roll = 1):
if (Player := player[Agent]):
granter_device.GrantItem(Player)
# Rolls of 2, 3, or 4 fall through here and do nothing.
Verse Library
verse
02 Fragment
Grants items with a specific probability when a player presses a button.
verse-library/using-produce-consumables-in-fortnite-creative/02-fragment.verse