teleporting prop to player

I want to use a remote to teleport a prop to a player for a small amount of time,
i’ve figured out how to teleport the prop, but i cant figure out how to get the player position

this is the code i have so far:

using { /Verse.org/Simulation }
using { /Verse.org/Verse }
using { /Fortnite.com/Devices }
using { /Fortnite.com/Game }
using { /Fortnite.com/Characters }

signalremote := class(creative_device):

@editable
SignalRemoteManager:signal_remote_manager_device = signal_remote_manager_device{}
@editable
Prop:creative_prop = creative_prop{}


OnBegin<override>()<suspends> : void =
    SignalRemoteManager.PrimarySignalEvent.Subscribe(SignalRemotePrimarySignalEvent)

    
SignalRemotePrimarySignalEvent(Player:agent) : void = 
    Print("test")
    if (Prop.TeleportTo[]) {}

Hey, I’ve written a script that implements and explains how to do it.
Feel free to ask about anything that’s not clear.

using { /Verse.org/Simulation }
using { /Verse.org/Verse }
using { /Fortnite.com/Devices }
using { /Fortnite.com/Game }
using { /Fortnite.com/Characters }

# Teleports the given Prop to the Player after SecondsBeforeTeleport.
TeleportPropToPlayerAfterDelay<public>(Prop:creative_prop, InPlayer:player, SecondsBeforeTeleport:float)<suspends>:void=
    Sleep(SecondsBeforeTeleport)
    # Since we have multiple function calls that could fail, we can wrap all of them in a single
    # failure context (the if statement). If any of the function calls fail, the entire block will rollback.
    if:
        # We need to retrieve the fort_character from the player, which is the actual pawn that the player controls.
        FortCharacter := InPlayer.GetFortCharacter[]
        # fort_character implements the positional interface, which means we can call GetTransform on it.
        Transform := FortCharacter.GetTransform()
        Prop.TeleportTo[Transform.Translation, Transform.Rotation] 
    then:
        Print("Prop Teleported to Player!")

signal_remote_mover := class(creative_device):
    @editable
    SignalRemoteManager:signal_remote_manager_device = signal_remote_manager_device{}
    @editable
    Prop:creative_prop = creative_prop{}
    @editable
    SecondsBeforeTeleport:float = 1.0

    OnBegin<override>()<suspends>:void=
        SignalRemoteManager.PrimarySignalEvent.Subscribe(SignalRemotePrimarySignalEvent)
        
    SignalRemotePrimarySignalEvent<private>(Agent:agent):void= 
        # We need to make sure the Agent is actually a player by casting to the player type.
        if (TargetedPlayer := player[Agent]):
            # Since you'd like some delay before the prop teleports to the player, we'll use a coroutine.
            # A coroutine is created by `spawn`ing an asynchrounous (<suspends>) function.
            spawn{TeleportPropToPlayerAfterDelay(Prop, TargetedPlayer, SecondsBeforeTeleport)}
3 Likes

it doesn’t work for me, the prop doesn’t teleport to me

Hi,
do you have the script for the props to follow the player live
thank you in advance

I think its because of this line, players are now called agents

chrome_dUVd0orNMr

1 Like