Let's say we have three players. We'll use three admin's names for convenience, so Builderman, Matt Dusek, and OstrichSized. Is it possible to send Builderman to "Area B", Matt to "Area M", and OstrichSized to "Area O" based on the first letter of their username? (Including numbers and whatever else ROBLOX has allowed players to put in their name)
COMMUNITY QUESTION
Is it possible to send players to a certain area of the map based on their name?
1 answer
The simplest way to do this is to make one main script that detects when a new character is spawned. Then, with the character, get the player. Once you have the player, you will need to get the first character of the player's name, which can be accomplished with the string.sub() function. Then just use a simple system of if statements to decide where to put them. Then move the character using the model:MoveTo(position) function.
The main framework of a script like this would have this basic design:
--object added to Workspace, so do the following (assume new object is "obj"):
----use GetPlayerFromCharacter() to see if it's a player
----if there's a player:
------use string.sub() and string.lower() to get the first letter and store it as "firstLetter"
------if firstLetter=="a" then
--------move to "a" territory
------else if firstLetter=="b" then
--------move to "b" territory
------and so on.
I hope this helped!
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
what is the player name starts with a number?