I’m trying to move the CloudProp to the nearest Player, now I have the Position of all Players including the instigating player of the blue remote Device, but on theCloudProp.MoveTo(PlayerPosition + vector5, rotation{}, 0.1) this error comes up : “This invocation calls a function that has the ‘suspends’ effect, which is not allowed by its context.(3512)” Here’s the code and I would appreciate any help
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /Fortnite.com/Characters }
spawncloud := class(creative_device):
@editable
CloudProp : creative_prop = creative_prop{}
@editable
SignalRemoteBlue : signal_remote_manager_device = signal_remote_manager_device{}
HandlePrimaryButton ( P : agent) : void =
loop:
if (F := P.GetFortCharacter []):
PlayerPositiont : vector3 = F.GetTransform().Translation
if(PlayerList := GetPlayspace().GetPlayers(), FortniteCharacter := PlayerList[0].GetFortCharacter[]):
PlayerPosition : vector3 = FortniteCharacter.GetTransform().Translation
if(PlayerList1 := GetPlayspace().GetPlayers(), FortniteCharacter1 := PlayerList[1].GetFortCharacter[]):
PlayerPosition1 : vector3 = FortniteCharacter1.GetTransform().Translation
if(PlayerList2 := GetPlayspace().GetPlayers(), FortniteCharacter2 := PlayerList[3].GetFortCharacter[]):
PlayerPosition2 : vector3 = FortniteCharacter1.GetTransform().Translation
if(PlayerList3 := GetPlayspace().GetPlayers(), FortniteCharacter3 := PlayerList[4].GetFortCharacter[]):
PlayerPosition3 : vector3 = FortniteCharacter1.GetTransform().Translation
if(PlayerList4 := GetPlayspace().GetPlayers(), FortniteCharacter4 := PlayerList[5].GetFortCharacter[]):
PlayerPosition4 : vector3 = FortniteCharacter1.GetTransform().Translation
if(PlayerList5 := GetPlayspace().GetPlayers(), FortniteCharacter5 := PlayerList[6].GetFortCharacter[]):
PlayerPosition5 : vector3 = FortniteCharacter1.GetTransform().Translation
if(PlayerList6 := GetPlayspace().GetPlayers(), FortniteCharacter6 := PlayerList[7].GetFortCharacter[]):
PlayerPosition6 : vector3 = FortniteCharacter1.GetTransform().Translation
if(PlayerList7 := GetPlayspace().GetPlayers(), FortniteCharacter7 := PlayerList[8].GetFortCharacter[]):
PlayerPosition7 : vector3 = FortniteCharacter1.GetTransform().Translation
if(PlayerList8 := GetPlayspace().GetPlayers(), FortniteCharacter8 := PlayerList[9].GetFortCharacter[]):
PlayerPosition8 : vector3 = FortniteCharacter1.GetTransform().Translation
if(PlayerList9 := GetPlayspace().GetPlayers(), FortniteCharacter9 := PlayerList[10].GetFortCharacter[]):
PlayerPosition9 : vector3 = FortniteCharacter1.GetTransform().Translation
var Distance1 : float = Distance(PlayerPositiont, PlayerPosition)
var Distance2 : float = Distance(PlayerPositiont, PlayerPosition1)
var Distance3 : float = Distance(PlayerPositiont, PlayerPosition2)
var Distance4 : float = Distance(PlayerPositiont, PlayerPosition3)
var Distance5 : float = Distance(PlayerPositiont, PlayerPosition4)
var Distance6 : float = Distance(PlayerPositiont, PlayerPosition5)
var Distance7 : float = Distance(PlayerPositiont, PlayerPosition6)
var Distance8 : float = Distance(PlayerPositiont, PlayerPosition7)
var Distance9 : float = Distance(PlayerPositiont, PlayerPosition8)
var Distance10 : float = Distance(PlayerPositiont, PlayerPosition9)
vector5 := vector3 {X:= 0.0, Y:= 0.0, Z:= 350.0}
if (Distance1 < Distance2 and Distance1 < Distance3 and Distance1 < Distance4 and Distance1 < Distance5 and
Distance1 < Distance6 and Distance1 < Distance7 and Distance1 < Distance8 and Distance1 < Distance9 and
Distance1 < Distance10):
CloudProp.MoveTo(PlayerPosition + vector5, rotation{}, 0.1)
else:
break
if (Distance2 < Distance1 and Distance2 < Distance3 and Distance2 < Distance4 and Distance2 < Distance5 and
Distance2 < Distance6 and Distance2 < Distance7 and Distance2 < Distance8 and Distance2 < Distance9 and
Distance2 < Distance10):
CloudProp.MoveTo(PlayerPosition1 + vector5, rotation{}, 0.1)
else:
break
if (Distance3 < Distance1 and Distance3 < Distance2 and Distance3 < Distance4 and Distance3 < Distance5 and
Distance3 < Distance6 and Distance3 < Distance7 and Distance3 < Distance8 and Distance3 < Distance9 and
Distance3 < Distance10):
CloudProp.MoveTo(PlayerPosition2 + vector5, rotation{}, 0.1)
else:
break
if (Distance4 < Distance1 and Distance4 < Distance2 and Distance4 < Distance3 and Distance4 < Distance5 and
Distance4 < Distance6 and Distance4 < Distance7 and Distance4 < Distance8 and Distance4 < Distance9 and
Distance4 < Distance10):
CloudProp.MoveTo(PlayerPosition3 + vector5, rotation{}, 0.1)
else:
break
if (Distance5 < Distance1 and Distance5 < Distance2 and Distance5 < Distance3 and Distance5 < Distance4 and
Distance5 < Distance6 and Distance5 < Distance7 and Distance5 < Distance8 and Distance5 < Distance9 and
Distance5 < Distance10):
CloudProp.MoveTo(PlayerPosition4 + vector5, rotation{}, 0.1)
else:
break
if (Distance6 < Distance1 and Distance6 < Distance2 and Distance6 < Distance4 and Distance6 < Distance5 and
Distance6 < Distance3 and Distance6 < Distance7 and Distance6 < Distance8 and Distance6 < Distance9 and
Distance6 < Distance10):
CloudProp.MoveTo(PlayerPosition5 + vector5, rotation{}, 0.1)
else:
break
if (Distance7 < Distance1 and Distance7 < Distance2 and Distance7 < Distance4 and Distance7 < Distance5 and
Distance7 < Distance6 and Distance7 < Distance3 and Distance7 < Distance8 and Distance7 < Distance9 and
Distance7 < Distance10):
CloudProp.MoveTo(PlayerPosition6 + vector5, rotation{}, 0.1)
else:
break
if (Distance8 < Distance1 and Distance8 < Distance2 and Distance8 < Distance4 and Distance8 < Distance5 and
Distance8 < Distance6 and Distance8 < Distance7 and Distance8 < Distance3 and Distance8 < Distance9 and
Distance8 < Distance10):
CloudProp.MoveTo(PlayerPosition7 + vector5, rotation{}, 0.1)
else:
break
if (Distance9 < Distance1 and Distance9 < Distance2 and Distance9 < Distance4 and Distance9 < Distance5 and
Distance9 < Distance6 and Distance9 < Distance7 and Distance9 < Distance8 and Distance9 < Distance3 and
Distance9 < Distance10):
CloudProp.MoveTo(PlayerPosition8 + vector5, rotation{}, 0.1)
else:
break
if (Distance10 < Distance1 and Distance10 < Distance2 and Distance10 < Distance4 and Distance10 < Distance5 and
Distance10 < Distance6 and Distance10 < Distance7 and Distance10 < Distance8 and Distance10 < Distance9 and
Distance10 < Distance3):
CloudProp.MoveTo(PlayerPosition9 + vector5, rotation{}, 0.1)
else:
break
else:
break
else:
break
else:
break
else:
break
else:
break
else:
break
else:
break
else:
break
else:
break
else:
break
else:
break
OnBegin<override> ()<suspends>:void=
SignalRemoteBlue.PrimarySignalEvent.Subscribe(HandlePrimaryButton)