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

How do you script a team change line? [The way I do it doesnt work]

I'm doing a team change gui and the team changing line doesnt work. For example:

script.Parent.MouseButton1Click:Connect(function() game.Players.LocalPlayer.TeamColor = BrickColor.new("Bright red") game.Players.LocalPlayer:LoadCharacter() end)

2 answers

You have to make it so their Team is TeamNameHere, not just TeamColor. Doing TeamColor should just change their color, not their actual team.

5 comments

0

actually, changing the Team Colour automatically changes the team for that player

0

@JellyYn can you give me an example of script? Also, chexy, that didnt work

0

and example would be like (inside the MouseButton1Down:Connect(function)) "game.Players.LocalPlayer.Team = game.Teams.Allies" I don't know for sure it works, but try it. Also, get rid of the LoadChar thing, and make sure the code is in a LocalScript

0

Worked, thank you SOO much!

0

No problem @gioreyes1234. Always happy to help

Just note, LoadCharacter can only be called from the server.

Try this code instead, make sure it's a LocalScript for it to work.

local player = game.Players.LocalPlayer

script.Parent.MouseButton1Down:Connect(function()
       player.TeamColor = BrickColor.new('Bright red')
end)

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