# vfx\_spawner that should follow the player

**URL:** <https://forums.unrealengine.com/t/vfx-spawner-that-should-follow-the-player/1611314>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [January 13, 2024, 3:10pm UTC](https://forums.unrealengine.com/t/vfx-spawner-that-should-follow-the-player/1611314 "2024-01-13T15:10:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Galinha](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/galinha/32/881673_2.png) [@Galinha](https://forums.unrealengine.com/u/Galinha)\
**Post date:** [January 13, 2024, 3:10pm UTC](https://forums.unrealengine.com/t/vfx-spawner-that-should-follow-the-player/1611314/1 "2024-01-13T15:10:24Z")

</div>

I have a script that should activate a vfx\_spawner that would follow the Pos/Rot of the player who was walking, thus making the effect follow him. But when I put Pos/Rot inside a loop it gives me this error.  
Error: To prevent infinite immediate iteration, `loop` must have one or more subexpressions that are either async (such as a coroutine) or a jump out (such as `break` or `return`).  
Does anyone know how to solve it?

```auto
using { /Fortnite.com/Characters }
using { /Fortnite.com/Devices }
using { /Fortnite.com/Game }
using { /Fortnite.com/UI }
using { /Verse.org/Simulation }
using { /Verse.org/Colors }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /UnrealEngine.com/Temporary/Diagnostics }

effect_neon := class(creative_device):

    @editable VFXLightning: vfx_spawner_device = vfx_spawner_device{}
    SprintState: logic = false # Use logic para representar estados lógicos

    OnSprintedStateChanged(Character : fort_character, SprintingResult: logic): void := # Método chamado quando o estado de sprint é alterado
    
    
        if:
            Sprinting := SprintingResult? # Use '?' para tratar a condição de falha

        then:
            ActivateVFX(Character) # O personagem começou a correr, ativar o efeito

    ActivateVFX(Character : fort_character) : void :=
        loop:
            Pos := Character.GetTransform().Translation
            Rot := Character.GetTransform().Rotation
            if: 
                VFXLightning.TeleportTo[Pos, Rot] # Teleporta o efeito para a posição do personagem
            

    OnBegin<override>()<suspends> : void :=
        for (Player : GetPlayspace().GetPlayers(), FortCharacter := Player.GetFortCharacter[]):
            FortCharacter.SprintedEvent().Subscribe(OnSprintedStateChanged) # Inscreva-se para rastrear mudanças de sprint

```
