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

If/Else statement not working properly?

Asked by 9 years ago

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

001timer1 = game.Workspace.Timer1
002timer2 = game.Workspace.Timer2
003clickable = true
004term = script.Parent
005team_color = nil
006 
007function refresh_term()
008    -- is this needed?
009end
010 
011function find_team(color)
012    for i,v in pairs(game.Teams:GetChildren()) do
013        if v.TeamColor == color then
014            return v
015        else
View all 102 lines...

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.

2
Post a bit more code, please. Perci1 4988 — 9y
0
It may be because if statements only run once? TheDeadlyPanther 2460 — 9y
0
The part that doesn't work is line 89-93 fireflame09225 11 — 9y

Answer this question