I'm currently getting a problem in my script where a BodyVelocity gets a direction and everything and it works fine when no in a server. But in a server it doesn't work. The error is apparently on the line where i determine the direction a blast should go. This code is inside a server script.

Script:

local BV = Instance.new("BodyVelocity")
	BV.Parent = Blast
	BV.maxForce = Vector3.new(math.huge, math.huge, math.huge)
	local direction = -(Blast.Position - player:GetMouse().Hit.p)
	BV.Velocity = direction.unit * 80

Any help?

6 comments

0

does unit exists?

0

.unit is a vector3 thing, that line is perfectly valid, possibly Blast is nil, try using print to see what all your variables are, one of them must be nil, and then you can do further debugging from there.

0

I think the variable blast is nil

0

Which line is line 21

0

line 21 is local direction

0

@theCJarmy7 I thought that Blast may be nil as well so I went and did player.Character.Blast.Position instead and it still didn't work.