i am making an intro gui (with a confirm button) not too fancy. I made it so you can choose your team color. This is my script and i totally dont understand why it is not working :(

local teamFrame = script.Parent.Parent.Parent
local confirm = script.Parent
local CONFIRM = false

local blue = game.StarterGui.ScreenGui.TeamFrame.Blue
local green = game.StarterGui.ScreenGui.TeamFrame.Green
local red = game.StarterGui.ScreenGui.TeamFrame.Red
local yellow = game.StarterGui.ScreenGui.TeamFrame.Yellow

local BLUE = "I dont want this team"
local GREEN = "I dont want this team"
local RED = "I dont want this team"
local YELLOW = "I dont want this team"

blue.MouseButton1Click:Connect(function()
	BLUE = "I think want this team"
	GREEN = "I dont want this team"
	RED = "I dont want this team"
	YELLOW = "I dont want this team"
end)

green.MouseButton1Click:Connect(function()
	BLUE = "I dont want this team"
	GREEN = "I think want this team"
	RED = "I dont want this team"
	YELLOW = "I dont want this team"
end)

red.MouseButton1Click:Connect(function()
	BLUE = "I dont think want this team"
	GREEN = "I dont want this team"
	RED = "I think want this team"
	YELLOW = "I dont want this team"
end)

yellow.MouseButton1Click:Connect(function()
	BLUE = "I dont want this team"
	GREEN = "I dont want this team"
	RED = "I dont want this team"
	YELLOW = "I think want this team"
end)

confirm.MouseButton1Click:Connect(function()
	CONFIRM = true
	wait(3)
	CONFIRM = false
end)

if BLUE == "I think want this team" and CONFIRM == true then
	game.Players.LocalPlayer.Team = game.Teams.Team1
end

3 comments

0

Please use the Lua button to properly highlight your code...

0

The thing is, you're firing your if statement as soon as the script starts. Maybe make it a function and call it after the confirm button has been clicked?

0

is it not better to put it in a while loop so it checks it every half a second then?