Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 9 years ago

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
Can't you just disable `ChangeTeamOnTouch` on the spawn and set the AutoAssignables correctly? BlueTaslem 18071 — 9y
0
@ BlueTaslem , Then how are you supposed to make checkpoints? EzraNehemiah_TF2 3552 — 9y
0
Thats what I was going to say, except not in front of Mr. 1573 Rep here groovydino 2 — 9y

1 answer

Log in to vote
2
Answered by 9 years ago

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

Ad

Answer this question