I need to change a player's team! What is the error here?
Hi helpers, I'm trying to make a script so that, once a button is pressed, the player that clicked it will change to a different team. This is inside a LocalScript, which is inside StarterGui.
01 | local SGui = game.StarterGui.ScreenGui |
02 | local Duel = Instance.new( "TextButton" ) |
03 | local Player = game.Players.LocalPlayer |
05 | Duel.Position = UDim 2. new( 0 , 0 , 0.5 , 0 ) |
06 | Duel.Size = UDim 2. new( 0.1 , 0 , 0.1 , 0 ) |
07 | Duel.Text = "Duel Area" |
09 | Duel.BackgroundColor 3 = Color 3. fromRGB( 127 , 142 , 100 ) |
10 | Duel.TextColor 3 = Color 3. fromRGB( 0 , 0 , 0 ) |
12 | Duel.BorderSizePixel = 0 |
15 | plr.Team = game.Teams.Duelling |
18 | Duel.MouseButton 1 Down:connect(GoDuel) |
The entire first chunk is only about the textbutton, so you can ignore that.
There are two teams; Duelling, and Shooting Stalls. The player's team is supposed to switch from Shooting Stalls to Duelling.
If someone could find the error in this script, it would be much appreciated.