Easy Written By Worthy0ne

Spawning A Player Created on: 01-01-2019

Spawn, position, and assign a player's team

OverView

I will teach you how to spawn a player WITHOUT the use of Roblox's Spawn Part. This will involve loading the player's character, positioning the character, and changeing the character's team!

Loading The Player Character

Loading the character is simple! Just use the following code inside a script... (Assume our player's name is "Player1")

game.Players.Player1:LoadCharacter()

Pretty simple! Now this will spawn Player1's character in the middle of the map by defualt OR at a spawn part if there is one in the game.

Now lets make a custom Spawn part/location!

Position The Player's Character

Now that the player's character is in the workspace, we can place him at a desired location!

We will create a part and make it our spawn. Then move the player on the spawn.

local character = game.Players.Player1.Character --this refrences the character we just spawned

local SP = Instance.new("Part") --this creates a generic part
SP.Position = Vector3.new(50,0,50) --lets have our spawn at position X:50 Y:0 Z:50

SP.Anchored = true --anchoring the part will prevent it from falling

SP.Parent = workspace --This places the spawn inside workspace

--Now that we have our spawn and character lets move the character to the spawn
character.HumanoidRootPart.CFrame = SP.CFrame * CFrame.new(0,5,0)
--CFrame stands for Cordinate Frame. Its a better way of positioning things.
--The code above positions the character where the spawn is positioned then moves
--the character 5 studs above then spawn so the character is not stuck inside.
--notice we use a "*" instead of a "+"

Changing The Player's Team

Now that we have the player spawned and where we want him, its time to assign what team he is on!

local player = game.Players.Player1 --refrences the player (not his character like we did before)

local redTeam = Instance.new("Team") --creates the team
redTeam.TeamColor = BrickColor.new("Really red") --changing team color
redTeam.Name = "Red Fighters" --changing team name
redTeam.Parent = game.Teams --places the team instance in the "Teams" folder

--We created the team lets assign Player1 to the Red Fighters.
player.Team = redTeam

There you have it! Keep in mind this code will require some changes to work for your needs, but this is the basics. This method of spawning players can be used in mini-games, round based games, or any game that requires teams or players to be spawned!

NOTE: You may need to disabled "CharacterAutoLoads" in your game. This will disable the automatic spawning of player after dealth. To disable this go into your game. go to your Explorer window, game>Players>CharacterAutoLoads and set it to false by clicking the square.

GL Dev! :)

Easy Written By Worthy0ne

See Worthy0ne's profile on Roblox

Discussion