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.
local SGui = game.StarterGui.ScreenGui
local Duel = Instance.new("TextButton")
local Player = game.Players.LocalPlayer
Duel.Parent = SGui
Duel.Position = UDim2.new(0, 0, 0.5, 0)
Duel.Size = UDim2.new(0.1, 0, 0.1, 0)
Duel.Text = "Duel Area"
Duel.Font = "Bodoni"
Duel.BackgroundColor3 = Color3.fromRGB(127, 142, 100)
Duel.TextColor3 = Color3.fromRGB(0, 0, 0)
Duel.TextSize = 27
Duel.BorderSizePixel = 0
function GoDuel(plr)
plr.Team = game.Teams.Duelling
end
Duel.MouseButton1Down: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.

5 comments
Filtering Enabled or not?
Post the error please and tell me whether it is FE or not
No, FilteringEnabled is not enabled.
:connect is deprecated, use :Connect
T0XN :connect still works, so either way its going to be a different problem, cooldeath49, try basic troubleshooting first, try checking spelling, and if referenced items actually exist (and for god sake use enums)