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.
To use the SpawnWithFriends module in an experience:
- Visit the SpawnWithFriends marketplace page, click the green Get button, and confirm the transaction.
- In Studio, open the toolbox (View → Toolbox).
- Select your toolbox Inventory section.
- Locate the module item and click it or drag-and-drop it into the 3D view.
- 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.
Advanced Installation Options »
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.
Instance/Destroy|Destroy()run on it immediately after this event is fired.
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:
- Fill the restricted area with invisible anchored blocks. Make sure
BasePart/CanQuery|CanQueryare set to false for all blocks.
- Apply the RestrictedSpawnArea tag to each block so that
CollectionServicedetects them (the Tag Editor plugin may be helpful).
- Paste the following code into a
Overrides the default configurations with the given values. This function can only be called from a
|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.|
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
Allows you to perform custom pre-teleportation checks by hooking up a validator callback function. The callback receives three parameters:
|playerToTeleport||Reference to the
|destinationPlayer||Reference to the target
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