hello, i tryng to create a teleport foward mechanic, where the players click on the remote control and get teleported 12 meters foward, its everything okay, but i can’t create the teleport device, i tried to create a prop, and attach the teleport device in this prop, so, when the players click on the remote control, he creates a prop, teleport device follows this prop, and he is teleported!
(sry for broke english)
also my discord is vets#4869
Script:
var Player : []player = array{} #
@editable TpControl : signal_remote_manager_device = signal_remote_manager_device{}
@editable PropToTp : creative_prop_asset = DefaultCreativePropAsset
@editable TpDevice :teleporter_device = teleporter_device{}
@editable TimerToTp : timer_device = timer_device{}
@editable MoveToProp: creative_prop = creative_prop{}
@editable VectorProp: vector3 = vector3{}
var floatingrandom : float = 0.1
ToTeleport (Agent: agent):void=
if (FortCharacter :=Agent.GetFortCharacter[]):
PlayerPos := FortCharacter.GetTransform().Translation
TpPos := FortCharacter.GetViewRotation().GetLocalForward() * 800.00
TpSpawnPos := PlayerPos + TpPos
Result := SpawnProp(PropToTp, TpSpawnPos, rotation{})
FortCharacter.PutInStasis(stasis_args{AllowTurning := true})
TimerToTp.Start()
UnFreeze(Agent:agent):void =
if(FortCharacter:=Agent.GetFortCharacter[]):
FortCharacter.ReleaseFromStasis()
# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=
set Player = GetPlayspace().GetPlayers()
TpControl.PrimarySignalEvent.Subscribe(ToTeleport)
TpDevice.TeleportedEvent.Subscribe(UnFreeze)