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

why the parameter i pass in return nil?

Asked by 3 years ago

so my function in module require a character variable, so i pass it in:

local script:

grav.Grav(Character)

module script:

force.Grav = function(char)
    if dead.Value == false then
        char:SetPrimaryPartCFrame(CFrame.new(0, char.PrimaryPart.Position.Y + MyForce, 0))

        force.SetForce(force.GetForce() + Acc)

        wait()

        return force.Grav()
    else
        wait()
        return force.Grav()
    end
end

but for some reason the character value return nil when i pass it in the module function. Any idea? Here is the error: attempt to index nil with 'PrimaryPart'

0
It's because when you return the "force.Grav()" you don't send the character with it the8bitdude11 358 — 3y
0
oh nice thanks daokhiethy 25 — 3y

Answer this question