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

Won't work? - supposed to teleport you on respawn if you're on blue or red team

Asked by 9 years ago

game.Players.PlayerAdded:connect(function (plr) plr.CharacterAdded:connect(function (char) wait(.5) if plr.TeamColor=="Bright blue" then char.Torso.CFrame=game.Workspace.BTeamPart.CFrame+CFrame.new(math.random(1,9), 0, math.random(1,9)) elseif plr.TeamColor=="Bright red" then char.Torso.CFrame=game.Workspace.RTeamPart.CFrame+CFrame.new(math.random(1,9), 0, math.random(1,9)) end end) end)


I opened the dev console and there are no errors for this.

0
A CFrame is a 3 part position, you only added 2 parts. 0,0,0 not 0,0 ConnorVIII 448 — 9y

1 answer

Log in to vote
0
Answered by
DataStore 530 Moderation Voter
9 years ago

The issue with what you're doing is the fact that you're attempting to check whether a BrickColor (the player's TeamColor) is a equal to a particular string - It never will be.

The following changes to the if statements should fix the issue.

if plr.TeamColor == BrickColor.new("Bright blue") then
if plr.TeamColor == BrickColor.new("Bright red") then

It should be noted, however, that if you're using a SpawnLocation (which is associated with a team) they will already be transported to their respective spawns when they, well, spawn.

Ad

Answer this question