Help coding freshman ,Please

Hello,gentlemen

this is my code

i want to make a prop to follow player

when the player in team1

but i dont know where is the mistake

help,please

rpg_player := class<concrete>():
    @editable
     VFXSpawner : vfx_spawner_device = vfx_spawner_device{}
    @editable
    DamageDevice : damage_volume_device = damage_volume_device{}
    @editable
    DeviceMover : creative_prop = creative_prop{}
    @editable 
    SuperButton : button_device = button_device{}
    @editable
    SFXPlayer : audio_player_device = audio_player_device{}

    DoFollowPlayer(IPlayer : player)<suspends> : void =
        loop:
            if (Fortnitecharacter := IPlayer.GetFortCharacter[]): 
                PlayerPosition : vector3 = Fortnitecharacter.GetTransform().Translation
                DeviceMover.MoveTo(PlayerPosition, rotation{}, 0.1)



game_dominator := class(creative_device):
    @editable var Team1Players : []rpg_player = array{}

    OnBegin<override>()<suspends>:void=
        AllPlayers := GetPlayspace().GetPlayers()   
        var T1IDX : int = 0
        for (IDX := 0..AllPlayers.Length - 1):       
            if(Agent := AllPlayers[IDX], AgentTeam := GetPlayspace().GetTeamCollection().GetTeam[Agent]):  
                if (AgentTeam = 1, RPGPlayer := Team1Players[T1IDX], Team1Player := AllPlayers[IDX] ):     
                    RPGPlayer.DoFollowPlayer(Team1Player)
                    set T1IDX = T1IDX + 1

And the out put log show like this:
`

LogVerse: Warning: Devices_move_to_debug_log: MoveTo error: The object being moved is no longer valid (e.g., it has been destroyed during gameplay or disposed of by verse or ‘Register with Structural Grid’ was specified for it in UEFN)

Thanks

I’m going to assume that the DeviceMover prop bind is setup correctly in UEFN, your prop probably got destroyed during the process as it is told in the message. Props can die when getting moved if they collide with other actors and if they’re damageable

You should be able to uncheck the Can be damaged checkbox on the actor

That’s so kind of you

i checked the checkbox

and loading sucess

But the other problem is that

in the test level

the prop doesnt follow the player

Can you help me with the problem ?

Thank you very much

I’m not sure why it doesn’t follow the player, it should work as long as your prop is referenced correctly and you player character can be retrieved

Btw, you have an infinite loop there when your GetFortCharacter fails (you can add a Sleep() when this condition fail)