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

Attempt to index a nil value?

Asked by 7 years ago

Again, script works fine in studio but errors when in game saying Attempt to index p0, a nil value. On line 17 (and 20?)

Script

--Fundmental Modules
local gs = require(game.ReplicatedStorage.Modules.Fundementals.GameSettings)
local eai = require(game.ReplicatedStorage.Modules.Classes.Enemy.EmemyAi)

--Events
local events = game.ReplicatedStorage.Events
local signal = events:WaitForChild("Signal")

--Main
signal.OnServerEvent:connect(function(plr,ver,p1,p2,p3)
    local bdfl = {
        DestroyEnemy = function(p0)
            eai:EndExistence(p0)

        end,
        UpdateTurretPosition = function(p0,p)
            if p0:isA('Model') then
                p0:SetPrimaryPartCFrame(p)
            elseif p0:isA('BasePart') then
                p0.CFrame = p
            end
        end
    }
    if ver == 'Backdoor' then
        bdfl[p1](p2,p3)
    end
end)

Answer this question