As requested, here is more of the code. This is actually the entire script. The part that doesn't work is line 89-93.

timer1 = game.Workspace.Timer1
timer2 = game.Workspace.Timer2
clickable = true
term = script.Parent
team_color = nil

function refresh_term()
	-- is this needed?
end

function find_team(color)
	for i,v in pairs(game.Teams:GetChildren()) do
		if v.TeamColor == color then
			return v
		else
			-- n/a
		end
	end
end

function cappable(player)
	if tostring(player.TeamColor) ~= team_color and player.TeamColor ~= "Black" then
		team_color = tostring(player.TeamColor)
		return true
	else
		return false
	end
end

function proper_grammar_lol(team)
	if tostring(team) == "FEAR" or tostring(team) == "fear" then
		return "s"
	else
		return "" 
	end
end

function start_timer()
	
end

function stop_timer(Owner, capturer)
	-- needs to go backwards
end

function cap_term_first_time(team)
	
	local gui = game.Workspace.GUIpart.SurfaceGui.Frame.MovingFrame
	local limit = 350 -- size of underlying frame
	local i = 0
	local pixels = 3.5 -- pixels per .1 second
	
	gui.BackgroundColor3 = team.TeamColor.Color

	while i <= limit do
	gui.Size = gui.Size + UDim2.new(0, pixels, 0, 0)
	i = i + pixels
	wait(.1)
	
	end
	
	term.owner.Value = tostring(team)
	
	timer1.change1.BrickColor = team.TeamColor
	timer1.change2.BrickColor = team.TeamColor
	timer1.change3.BrickColor = team.TeamColor
	timer1.change4.BrickColor = team.TeamColor
	timer2.change1.BrickColor = team.TeamColor
	timer2.change2.BrickColor = team.TeamColor
	timer2.change3.BrickColor = team.TeamColor
	timer2.change4.BrickColor = team.TeamColor	
	
	gui.Parent.TextLabel.Text = tostring(team).." own"..proper_grammar_lol(team).." the terminal."
	gui.Parent.TextLabel.TextColor3 = team.TeamColor.Color	
	
end

function cap_term(team)
	local m = Instance.new("Message", workspace)
	m.Text = "YES"
end

script.Parent.ClickDetector.MouseClick:connect(function(hit)
	if clickable == true then
		clickable = false
		
		local player = game.Players:findFirstChild(tostring(hit))
		if cappable(player) then
			if term.owner.Value == "none" then
				cap_term_first_time(find_team(player.TeamColor)) -- CAP TERM FIRST TIME
			else
				cap_term(find_team(player.TeamColor)) -- CAP TERM ANY OTHER TIME
			end
		else
			-- not cappable 
		end
	else
		print("nah b")
	end
	
	clickable = true
end)

For some reason this always fires the "else" portion. I can't figure out why. I printed out "term.owner.Value" right before this line of code and it prints out "none" and I check the owner StringValue manually and it says "none", which is what I set it to. This is exactly the condition that should make it fire the first part, not the else part.

I'm so confused.

3 comments

2

Post a bit more code, please.

0

It may be because if statements only run once?

0

The part that doesn't work is line 89-93