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'

2 comments

0

It's because when you return the "force.Grav()" you don't send the character with it

0

oh nice thanks