Attempt to call a table value

Hello
I got this weird error and I have 0 idea why there is an error. If anybody can catch it, then please let me know what it is.

Server script:

local spawnCFrame = script.Parent.Handle.Attachment.WorldPosition
		print(spawnCFrame)
		
		print(hit)
		
		spawnCFrame = spawnCFrame + (hit * 8)
		
		local blacklist = tool.Parent:GetDescendants()
		print(blacklist)
		
		print(typeof(projectileModule.new))
		
		local projectileInfo = projectileModule.new(1,blacklist,Vector3(0,0,0),8,0,0,projectile) --the error is on this line
		projectileInfo:Cast(spawnCFrame,hit,10)

Module script:

local projectile = {}
 
function projectile.new(gravity,blacklist,alternateForce,despawnTime,maxBounces,decay,projectileType)
	local newProjectile = {}
	
	newProjectile.Gravity = gravity
	newProjectile.AlternateForce = alternateForce
	newProjectile.DespawnTime = despawnTime
	newProjectile.MaxBounces = maxBounces
	newProjectile.Decay = decay
	
	local params = RaycastParams.new()
	params.FilterType = Enum.RaycastFilterType.Exclude
	params.FilterDescendantsInstances = blacklist
	newProjectile.Params = params

Thanks for the help :+1:

Is hit defined? Because you need hit to be defined in order to add. Also is hit a number or a part? Did you forget to return your model local projectile = {}

function projectile.new(gravity,blacklist,alternateForce,despawnTime,maxBounces,decay,projectileType)
local newProjectile = {}

newProjectile.Gravity = gravity
newProjectile.AlternateForce = alternateForce
newProjectile.DespawnTime = despawnTime
newProjectile.MaxBounces = maxBounces
newProjectile.Decay = decay

local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Exclude
params.FilterDescendantsInstances = blacklist
newProjectile.Params = params

end
return projectile

Hit is the .unit of the position of the mouse hit when the tool is activated.
I didn’t forget to return projectile

The error is on this line btw

local projectileInfo = projectileModule.new(1,blacklist,Vector3(0,0,0),8,0,0,projectile)

You should be doing Vector3.new(0,0,0)

1 Like

Bruh kinda crazy how I missed that lol

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.