This error is because you’re creating a function inside of OnBegin.
Every “Tab space” you make is like opening a new door with a room inside.

Everything has to be inside of the class, wich is the red line. If you in the same red-tab-space write something like bye_there_device := class(creative_device)
in programming would be like if you create another verse script. (Someone more experienced can correct me if i’m wrong, i’m just learning code 1 year ago as a hobby)
Then, inside the red color starts the code, where you should write your functions, OnBegin it’s a void function, like you wrote with HealPlayer().
The correct code should be like this:
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Playspaces }
using { /Verse.org/Simulation }
using { /Verse.org/Verse }
hello_there_device := class(creative_device):
# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void =
HealPlayer() : void =
Playspace: fort_playspace = GetPlayspace()
AllPlayers: []player = Playspace.GetPlayers()
if (FirstPlayer : player = AllPlayers[0]):
if (FortniteCharacter : fort_character = FirstPlayer.GetFortCharacter[]):
FortniteCharacter.Damage(100.0)
(Do you see it? HealPlayer is in the same Tab of OnBegin, that means he’s out of OnBegin function)

Now, as you can see, OnBegin shows a problem on “=”. That’s because OnBegin is empty, and if you don’t write nothing there you’re doing basically nothing. Then: How do I add that script to make it work?
Since you created a new function HealPlayer()
you can summon it inside of OnBegin to make it work onbeginthegame
# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void =
HealPlayer()
That should be do the trick!
About those colored lines
Everything you create are known by the next doors you create. If you create a variable inside of the pink line, you can use it in green or yellow one, like you do with FirstPlayer
or AllPlayers
that are being used inside green line, but they’re created in the pink one. but this don’t work backwards. Something you create in yellow will not work in the pink or green one.
TL;DR:
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Playspaces }
using { /Verse.org/Simulation }
using { /Verse.org/Verse }
hello_there_device := class(creative_device):
# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void =
HealPlayer()
HealPlayer() : void =
Playspace: fort_playspace = GetPlayspace()
AllPlayers: []player = Playspace.GetPlayers()
if (FirstPlayer : player = AllPlayers[0]):
if (FortniteCharacter : fort_character = FirstPlayer.GetFortCharacter[]):
FortniteCharacter.Damage(100.0)