As before, I am making a game involving Team Change.
When I made a GUI with a script telling it to make a GUI visible, when I told it to change the players teams, the script crashed.
Variables(for Team Change):
local Player = game.Players.LocalPlayer
local Citizen = game.Players.LocalPlayer:FindFirstChild("Team"):FindFirstChild("Citizen")
for the Visible part:
local Confirm = game.Players.LocalPlayer:FindFirstChild("PlayerGui"):FindFirstChild("Team Selector").Confirmation
The function:
script.Parent.MouseButton1Click:connect(function()
Confirm.Visible = true
Player.Team = Citizen
end)
Put Together:
local Confirm = game.Players.LocalPlayer:FindFirstChild("PlayerGui"):FindFirstChild("Team Selector").Confirmation
local Player = game.Players.LocalPlayer
local Citizen = game.Players.LocalPlayer:FindFirstChild("Team"):FindFirstChild("Citizen")
script.Parent.MouseButton1Click:connect(function()
Confirm.Visible = true
Player.Team = Citizen
end)
When run, Like I said, It all crashes. What do I have to do?

3 comments
If there are issues, feel free to comment below! I believe this would work theoretically but again, a RemoteEvent may be needed
Thanks. This is the current script
THANK YOU SO MUCH! It worked Perfectly.