Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How could I make someone start off at the blue team without making them touch another spawn?

So look, since my title is kind of confusing, so I will explain it to you.

When someone joins, they spawn on a colored spawn (at least in my obby, its colored, along with its own team). I want to make it so when someone joins, they will become blue team WITHOUT their character touching any other colored spawn.

I tried this by doing a script so when they join, I used :BreakJoints() on them, and then changed their teamcolor to blue. Then I realized that their limbs will touch the colored spawn, thus changing them to a different team before they respawn from death (Unless they are lucky and spawn with blue in the first place)

Help me out?

3 comments

3

Can't you just disable ChangeTeamOnTouch on the spawn and set the AutoAssignables correctly?

0

@ BlueTaslem , Then how are you supposed to make checkpoints?

0

Thats what I was going to say, except not in front of Mr. 1573 Rep here

1 answer

A player has a property named "TeamColor". You can change the TeamColor. TeamColors use BrickColor value. So for example:

game:GetService("Players").LordDragonZord.TeamColor = BrickColor.new(1)
game:GetService("Players").LordDragonZord.TeamColor = BrickColor.new("White")
game:GetService("Players").LordDragonZord.TeamColor = BrickColor.white()
--All of these work.

Start off with a team color script

To make someone start off like this we need to use the PlayerAdded event function.

game:GetService("Players").PlayerAdded:connect(function(plyr)
	plyr.TeamColor = BrickColor.Blue() --Blue
end)

Custom "spawn"

Now to make the spawn. Since you can touch and change teams with regular spawns after death, make a part a normal part that LOOKS like a spawn and insert this script.

script.Parent.Touched:connect(function(limb)
	local h = limb.Parent:FindFirstChild("Humanoid")
	local plyr = game:GetService("Players"):GetPlayerFromCharacter(limb.Parent)
	if h and plyr and h.Health < 0 then
		plyr.TeamColor = script.Parent.BrickColor --or plyr.TeamColor = BrickColor.new("White") or something...
	end
end


Hope this helps!

P.S. Here is the site where you can get the brick color codes and names. Do not use colors whose names are crossed out. That means the colors are bugged.

http://wiki.roblox.com/index.php?title=BrickColor_Codes

This discussion is preserved as it was. New answers, comments, and votes are closed.