Add a SpawnLocation parameter to Player.CharacterAdded

As a Roblox developer, it is currently too hard to detect what SpawnLocation a player spawned on. Adding a return value to Player.CharacterAdded that holds a reference to the SpawnLocation would make this process easier.

Use cases:

  • Adding particle/visual effects to the SpawnLocation when a player spawns
  • A SpawnLocation with a limited number of uses
  • SpawnLocation usage cooldown

If Roblox is able to address this issue, it would improve my development experience because I could easily add effects to SpawnLocations and detect what SpawnLocation a player spawned on.

This feature request originally asked for an event to be added to SpawnLocation, but @colbert2677 suggested that it be added to Player.CharacterAdded instead.

Original feature request:

As a Roblox developer, it is currently too hard to detect what SpawnLocation a player spawned on. Adding an event to SpawnLocation that fires when a player’s character spawns on that SpawnLocation would solve this problem.

Currently, to do this, you need to raycast down from the player’s character each time it spawns. However, there is the possibilty that there could be something between the character and the SpawnLocation, which would cause it to not be properly detected. Adding an event to SpawnLocation that fires when a player spawns on it would prevent any potential bugs with this method and would be more reliable.

Use cases:

  • Adding particle/visual effects to the SpawnLocation when a player spawns
  • A SpawnLocation with a limited number of uses

If Roblox is able to address this issue, it would improve my development experience because I could easily add effects to SpawnLocations and detect what SpawnLocation a player spawned on.

18 Likes

This is why RaycastFilterType exists. If you tag your spawns, you can get a list of tagged spawns to use for FilterDescendantsInstances and use the Whitelist RaycastFilterType. I get wanting to have an engine-supported method but you can already do this with existing API.

As for the proposal, well, sort of pointless to make another spawn event. There is already an event that determines when a player spawns in, CharacterAdded. If I were writing this feature request, my proposed solution would be another parameter that holds a reference to the SpawnLocation selected by the spawning logic. Easier to manage, easy to adjust towards and non-intrusive.

7 Likes

Thank you for the suggestion! I edited my original feature request to suggest adding a SpawnLocation parameter to Player.CharacterAdded instead.