Problem with an If statement?
For some reason this always fires the "else" portion in lines 89-93. I can't figure out why. I printed out "term.owner.Value" right before this line of code and it prints out "none" which is exactly the condition that should make it fire the first part, not the else part.
Btw, I set the StringValue owner to "none" by default.
001 | timer 1 = game.Workspace.Timer 1 |
002 | timer 2 = game.Workspace.Timer 2 |
007 | function refresh_term() |
011 | function find_team(color) |
012 | for i,v in pairs (game.Teams:GetChildren()) do |
013 | if v.TeamColor = = color then |
021 | function cappable(player) |
022 | if tostring (player.TeamColor) ~ = team_color and player.TeamColor ~ = "Black" then |
023 | team_color = tostring (player.TeamColor) |
030 | function proper_grammar_lol(team) |
031 | if tostring (team) = = "FEAR" or tostring (team) = = "fear" then |
038 | function start_timer() |
042 | function stop_timer(Owner, capturer) |
046 | function cap_term_first_time(team) |
048 | local gui = game.Workspace.GUIpart.SurfaceGui.Frame.MovingFrame |
053 | gui.BackgroundColor 3 = team.TeamColor.Color |
056 | gui.Size = gui.Size + UDim 2. new( 0 , pixels, 0 , 0 ) |
062 | term.owner.Value = tostring (team) |
064 | timer 1. change 1. BrickColor = team.TeamColor |
065 | timer 1. change 2. BrickColor = team.TeamColor |
066 | timer 1. change 3. BrickColor = team.TeamColor |
067 | timer 1. change 4. BrickColor = team.TeamColor |
068 | timer 2. change 1. BrickColor = team.TeamColor |
069 | timer 2. change 2. BrickColor = team.TeamColor |
070 | timer 2. change 3. BrickColor = team.TeamColor |
071 | timer 2. change 4. BrickColor = team.TeamColor |
073 | gui.Parent.TextLabel.Text = tostring (team).. " own" ..proper_grammar_lol(team).. " the terminal." |
074 | gui.Parent.TextLabel.TextColor 3 = team.TeamColor.Color |
078 | function cap_term(team) |
079 | local m = Instance.new( "Message" , workspace) |
083 | script.Parent.ClickDetector.MouseClick:connect( function (hit) |
084 | if clickable = = true then |
087 | local player = game.Players:findFirstChild( tostring (hit)) |
088 | if cappable(player) then |
089 | if term.owner.Value = = "none" then |
090 | cap_term_first_time(find_team(player.TeamColor)) |
092 | cap_term(find_team(player.TeamColor)) |