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

Why do i keep getting error (index a nil value) ?

Asked by 5 years ago
Edited 5 years ago
  • 20:48:13.471 - ServerScriptService.Main.RaceModule.FunctionScript.PlaceChecker NIL:21: attempt to index a nil value*
local RaceStatistics = game.Workspace.Game.RaceStatistics
local Positions = RaceStatistics.Positions

Bleh = false

RaceStatistics.Racing.Changed:connect(function(yus)

    if RaceStatistics.Racing.Value == true then
        if Bleh == false then

            Bleh = true

            repeat
                for i,k in pairs(game.Players:GetPlayers()) do
                    if k.TrackStatistics.Racing.Value == true then  
                        if k.Character:findFirstChild("UpperTorso") then

                            local magnitude = (k.Character.UpperTorso.Position - game.Workspace.Game.TimingSystem:findFirstChild("S"..k.TrackStatistics.Section.Value + 1).Position).magnitude

                            Positions[k.Name].Value = magnitude

                            local MyPos = 8

                            for i,v in next, Positions:GetChildren() do
                                if v.name ~= "NotUsed" then

                                    local temp = v.Name

                                    if game.Players[temp].TrackStatistics.Laps.Value < k.TrackStatistics.Laps.Value then
                                        MyPos = MyPos - 1
                                    elseif (game.Players[temp].TrackStatistics.Laps.Value == k.TrackStatistics.Laps.Value) and 
                                        (game.Players[temp].TrackStatistics.Section.Value < k.TrackStatistics.Section.Value) then 
                                        MyPos = MyPos - 1
                                    elseif (game.Players[temp].TrackStatistics.Laps.Value == k.TrackStatistics.Laps.Value) and 
                                        (game.Players[temp].TrackStatistics.Section.Value == k.TrackStatistics.Section.Value) and 
                                        (v.Value > Positions[k.Name].Value) then 
                                        MyPos = MyPos - 1
                                    end
                                end
                            end 

                            k.TrackStatistics.Position.Value = MyPos

end
end
end

wait()

until RaceStatistics.Racing.Value == false 

Bleh = false

end
end
end)

Dont see why i would need to add the rest of the script

0
Just add 1 more line, because this is where the error occured mixgingengerina10 223 — 5y
0
ok aleandroblingo -35 — 5y
0
ill just add that section ;/ aleandroblingo -35 — 5y
0
You're missing an "until" to end "repeat". User#19524 175 — 5y
0
ill just add the whole script ;/ sorry aleandroblingo -35 — 5y

Answer this question