of     1   

badgraphix
#150476730Wednesday, November 26, 2014 9:07 PM GMT

The loop works fine for all but one problem--visualgui can only be referenced on the first loop. After that, I get an output message that says "attempt to index field '?' (a nil value)" I'm guessing it has something to do with the fact that I'm restating what visualgui is on every loop. Could somebody explain why this script won't function? while true do wait(.5) community = game.Players:GetChildren() script.Bool.Value = true for i = 1, #community do substats = community[i].Speedstat:GetChildren() for i = 1, #substats do SUB = substats[i] Effect(SUB) TimeCheck(SUB) HERE---- visualgui = community[i].PlayerGui.GameStats:FindFirstChild(SUB.Name) print(visualgui.Name) visualgui.Num.Text = SUB.Time.Value if substats[i].Value == 1 or substats[i].Value == 3 then timer = substats[i].Time timer.Value = timer.Value - .5 end end end end
cntkillme
#150478352Wednesday, November 26, 2014 9:30 PM GMT

for i2 = 1, #substats do SUB = substats[i2]
badgraphix
#150889322Monday, December 01, 2014 7:50 PM GMT

Sorry but can I get some more context behind this? It doesn't seem like this would help and I'm not really sure where it would go.
cntkillme
#150910641Tuesday, December 02, 2014 12:01 AM GMT

Read this part carefully: 'for i = 1, #community do substats = community[i].Speedstat:GetChildren() for i = 1, #substats do SUB = substats[i]' Notice where your declaration of the local variable "i" prevents you from accessing the original local variable "i". So community[i] is actually from the variable from the for loop inside the other for loop, as opposed to this one 'for i = 1, #community do'

    of     1