Spawn with Friends

Spawn with Friends

It can be challenging to locate friends in-experience. The SpawnWithFriends developer module automatically moves spawning players near one of their friends present in the experience. This module can also be configured to teleport a player on command instead of automatically.

Module Usage


To use the SpawnWithFriends module in an experience:

  1. Visit the SpawnWithFriends marketplace page, click the green Get button, and confirm the transaction.
  2. In Studio, open the toolbox (ViewToolbox).
  3. Select your toolbox Inventory section.
  1. Locate the module item and click it or drag-and-drop it into the 3D view.
  2. In the Explorer window, move the entire SpawnWithFriends folder into ServerScriptService. Upon running the experience, the module will distribute itself to various services and begin running.

This and other developer modules come with an Install script that runs the installer and distributes the contents of the module to the same services that the folders are named after.

The Install script can be utilized as follows:

EnableLogging — Set to true to enable debug logging for the current developer module. This lets you see how the module gets distributed, along with how each package is linked.

InstallStarted — Fires when the installer first starts up. You can hook into this event to run any pre-install steps.

InstallFinished — Fires when the installer has finished installing the module. By this point, the contents of each service folder has been distributed. You can also hook into this event to run any post-install steps.

Install() — Installs the given developer module by overlaying each of the service folders over existing services. For example, a folder named ReplicatedStorage containing a SpawnWithFriends script will be distributed to game.ReplicatedStorage.SpawnWithFriends when installing.

Restricted Spawn Areas

This module may result in players spawning in restricted areas like VIP rooms, access-only spaces, etc. To prevent players from teleporting to these areas:

  1. Fill the restricted area with invisible anchored blocks. Make sure BasePart/CanCollide|CanCollide, BasePart/CanTouch|CanTouch, and BasePart/CanQuery|CanQuery are set to false for all blocks.
Block filling the entire prison room to prevent players from spawning inside
  1. Apply the RestrictedSpawnArea tag to each block so that CollectionService detects them (the Tag Editor plugin may be helpful).
  2. Paste the following code into a Script within ServerScriptService.

API Reference



void configure ( table config )

Overrides the default configurations with the given values. This function can only be called from a Script.

Key Default Description
teleportToFriendOnRespawn true If set to false, teleportation to a friend will only happen manually via teleportToRandomFriend().
teleportDistance 5 How far away players should spawn from each other, measured in studs.
maxCharacterVelocity 48 Characters moving faster than this value won't be picked as teleportation candidates, for instance those in moving vehicles.
bypassFriendshipCheck false If set to true, all players will be candidates for teleportation (not just friends).
showLogs false Whether or not to display log messages in the output.


bool teleportToRandomFriend ( Player playerToTeleport )

Manually triggers teleportation of a player to one of their friends in the experience. Returns a boolean indicating whether or not teleportation succeeded; failure to teleport can be caused by the absence of friends in the server or the inability to find an unobstructed teleportation point. This function can only be called from a Script.


void setTeleportationValidator ( function validator )

Allows you to perform custom pre-teleportation checks by hooking up a validator callback function. The callback receives three parameters:

Parameter Description
playerToTeleport Reference to the Player that is being teleported.
destinationPlayer Reference to the target Player that playerToTeleport is being teleported to.
teleportationPoint datatype/CFrame|CFrame where playerToTeleport is teleporting to.

This function can only be called from a Script and it returns a boolean indicating whether teleportation should proceed.

Previous Emote Bar Next Photo Booth