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

(Noob Alert!) Team Change script won't work?

Asked by 5 years ago

Full disclosure... I've learned how to do simple stuff with values, loading custom characters, etc. I'm basically a noob though.

I can't figure out what I am doing wrong here.

local plr = game.Players.LocalPlayer

plr.TeamColor.Name = "Bright yellow"

why doesn't this change the team to bright yellow?

3 answers

Log in to vote
0
Answered by
aazkao 787 Moderation Voter
5 years ago

When you assign a players team by their teamColor you need to use the BrickColor Constructor

local plr = game.Players.LocalPlayer

plr.TeamColor = BrickColor.new("Bright yellow")
0
Ah! Thank you for explaining that. Sadly, the code still doesn't work. :/ AzariahJenkins 0 — 5y
Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

aazkao is correct on one thing: You need to use BrickColor, not TeamColor.Name (error will output: "game.Players.AzariahJenkins.TeamcColor.Name = nil" or something along those lines)

You also need to be sure that you are using a Client-Side Script (local), not a Server-Side Script (plain).

To summarize:

• Use a LocalScript

• Using a client-side script, you can't call LocalPlayer in a server-side or it will cause an error.

• Use plr.TeamColor = BrickColor.new("Bright yellow")

Nothing more to it!

0
I really appreciate you taking the time to explain this to me! Unfortunately, it still doesn't work for some reason. However, you did give me the idea of making a local script, putting it in the starter pack, and using that to directly reach the player. So thank you :) AzariahJenkins 0 — 5y
0
no problem. I said to use a client-side because game.Players.>>LocalPlayer<< can't be called in a client-side. GamingZacharyC 152 — 5y
Log in to vote
-2
Answered by
markjac -11
5 years ago

Is this the full script?

0
You know that comments exist right User#19524 175 — 5y
0
Yes, it is. AzariahJenkins 0 — 5y

Answer this question