I wish for the prop to return to its designated position when the player dies whilst it is moving.

I’d like to make it so that a moving prop returns to its designated position when the player dies, but it’s not working properly, so I’d appreciate some guidance.

Upon death, instead of teleporting back to the designated location, it ends up somewhere else.

Perhaps it’s not working properly because the prop is being moved at the time?

using { /Fortnite.com/Devices }

using { /Verse.org/Simulation }

using { /UnrealEngine.com/Temporary/Diagnostics }

using { /UnrealEngine.com/Temporary/SpatialMath }

move_floor := class(creative_device):

@editable Floor_Cube : creative_prop= creative_prop{}

@editable FBarrier: barrier_device= barrier_device{}

@editable BBarrier: barrier_device= barrier_device{}

@editable Teleporter : teleporter_device = teleporter_device{}

@editable

var MovingTime : float = 10.0

@editable EliminationManager: elimination_manager_device = elimination_manager_device{}



Gamestert(Agent:agent):void=

    spawn:

        GamestertSuspends(Agent)

    spawn:

        GamestertFBarrier(Agent)

    spawn:

        GamestertBBarrier(Agent)



GamestertSuspends(Agent:agent)<suspends>:void=

   Transform := Floor_Cube.GetTransform()

   PositionX := Transform.Translation.X

   PositionY := Transform.Translation.Y

   PositionZ := Transform.Translation.Z

   Rotation := Transform.Rotation



   NowPosition := vector3{X := PositionX, Y:= PositionY, Z := PositionZ}



   NewRotation := Rotation.ApplyYaw(0.0)

   NewPosition := vector3{X := PositionX, Y:= PositionY+30298.0, Z := PositionZ}

   

   Floor_Cube.MoveTo(NewPosition,NewRotation,MovingTime)

    if(Floor_Cube.TeleportTo\[vector3{X:=4603.000000,Y:=14256.000000,Z:=4833.000000},Floor_Cube.GetTransform().Rotation\]):

        Print("kill you2")



OnBegin<override>()<suspends>:void=

    Teleporter.TeleportedEvent.Subscribe(Gamestert)

    EliminationManager.EliminationEvent.Subscribe(OnEliminated)