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

I need to change a player's team! What is the error here?

Asked by 7 years ago

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.

01local SGui = game.StarterGui.ScreenGui
02local Duel = Instance.new("TextButton")
03local Player = game.Players.LocalPlayer
04Duel.Parent = SGui
05Duel.Position = UDim2.new(0, 0, 0.5, 0)
06Duel.Size = UDim2.new(0.1, 0, 0.1, 0)
07Duel.Text = "Duel Area"
08Duel.Font = "Bodoni"
09Duel.BackgroundColor3 = Color3.fromRGB(127, 142, 100)
10Duel.TextColor3 = Color3.fromRGB(0, 0, 0)
11Duel.TextSize = 27
12Duel.BorderSizePixel = 0
13 
14function GoDuel(plr)
15    plr.Team = game.Teams.Duelling
16end
17 
18Duel.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.

0
Filtering Enabled or not? Nights_Alpha 0 — 7y
0
Post the error please and tell me whether it is FE or not Nights_Alpha 0 — 7y
0
No, FilteringEnabled is not enabled. cooldeath49 37 — 7y
0
:connect is deprecated, use :Connect T0XN 276 — 7y
0
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) fanofpixels 718 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

Roblox changed it so you must have it using ".TeamColor" at the end, Fixed code block:

1function GoDuel(plr)
2    plr.Team.TeamColor = game.Teams.Duelling.TeamColor
3plr.Character.Humanoid.Health = 0 --Remove this if you dont want them to change spawn locations.
4end
0
ok, thanks! cooldeath49 37 — 7y
Ad

Answer this question