Portal Gun and Teleporter Gun

AC Build Jam Submission
Game : Teleporter Gun Game - fyzrm3wp
Contributors : ekelrock
Package Name : Portal Gun and Teleport Gun
Description : A portal gun (like the game) and a teleporter gun (you shoot a marker and it moves you to the marker location when you press a button, or instantly depending on the configuration). It also includes the ability to manually place a spawn point at the player’s location when they press a button. Still a WIP – message me on the discord if you need help with it.
Category : SCRIPT

Add the “userSpawnPlacerScript” to your User template.
That’s all you need to do for the Portal Gun and Teleporter Gun to work.

The modified gunScript has a few additional properties for each gun type:

  • useAsTeleporterGun - This must be true for the teleporter gun to work.
  • spawnMarkerTemplate - This is the template that gets placed at the hit location of the teleporter gun.
  • autoMovePlayer - If true, this will move the player instantly when they shoot.
  • useAsPortalGun - This must be true for the portal gun to work.
  • portalTemplate1 & portalTemplate2 - The templates to spawn when using the portal gun.

The userSpawnPlacerScript also has some config options:

  • placeSpawnButton - If set, this is how a player can manually place a spawn point at their location.
  • spawnMarkerTemplate - This is the template that gets placed when the player hits the placeSpawnButton.
  • onlyPlaceIfAlive - If true, the player can only place a spawn loint if they’re alive. You probably want this to be true.
  • useAsTeleporter - If true, the placed spawn can be used as a teleporter. You might want this to be false if they should only go to that spawn point when they die.
  • teleportButton - The button to use if “useAsTeleporter” is true".
  • teleportSound - The sound to play when the player teleports.
  • setAsDefaultSpawn - If true, this will overwrite the “spawnPoint” property on the spawnUserScript. This could be useful if you never want the player to go back to their original world spawn. If false, they’ll only go to the marker location by hitting the teleport button.
  • respawnPlayerOnTeleport - This despawns and respawns the player when they teleport. This is more reliable than the SetPosition API used by default in the scripts. However, if true, it will also reset the other properties on the player (like their health) so it might now work for things like gun games.

You can see the teleporter gun in the game linked above.
Here’s a gif of the portal gun in action: