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

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

Asked by 6 years ago

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

Log in to vote
0
Answered by
JellyYn 70
6 years ago

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

0
actually, changing the Team Colour automatically changes the team for that player Rare_tendo 3000 — 6y
0
@JellyYn can you give me an example of script? Also, chexy, that didnt work gioreyes1234 5 — 6y
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 JellyYn 70 — 6y
0
Worked, thank you SOO much! gioreyes1234 5 — 6y
0
No problem @gioreyes1234. Always happy to help JellyYn 70 — 6y
Ad
Log in to vote
0
Answered by
Rare_tendo 3000 Moderation Voter Community Moderator
6 years ago

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)

Answer this question