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

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

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

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")

1 comment

0

Ah! Thank you for explaining that. Sadly, the code still doesn't work. :/

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!

2 comments

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 :)

0

no problem. I said to use a client-side because game.Players.>>LocalPlayer<< can't be called in a client-side.

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