Projectile Spazing in the air

So I have a slime and it shoots projectiles so after a couple of shots the slimeballs it shoots start to glitch up and down pretty fast and I have no idea why

sry the code it moved to the right a little

																local Hum = Spider.Zombie
																local RootPart = Spider.HumanoidRootPart
																local RunS = game:GetService('RunService')
																local RenderStepped = RunS.RenderStepped
																local Heartbeat = RunS.Heartbeat
																local Tool = game.ReplicatedStorage.Clones.SlimeBall
																local Handle = game.ReplicatedStorage.Clones.SlimeBall
																local CFrame_New =
																local Vector3_New =
																local T = 1;
																local Gravity = Vector3_New(0, -workspace.Gravity, 0)
																local Attach0 ="Attachment", workspace.Terrain)
																local Attach1 ="Attachment", workspace.Terrain)
																local function Velocity_Func()
																	local X0 = RootPart.CFrame * Vector3_New(0, 2, -2)
																	-- calculate the v0 needed to reach mouse.Hit.p
																	local V0 = (ClosestTarget.HumanoidRootPart.Position - X0 - 0.5*Gravity*T*T)/T;
																	-- have the ball travel that path
																	local Handle_Clone = Tool:Clone()
																	Handle_Clone.Velocity = V0;
																	Handle_Clone.CFrame = CFrame_New(X0)
																	Handle_Clone.Parent = workspace
																local function BeamProjectile_Func(V0, X0, T1)
																	-- calculate the bezier points
																	local C = 0.5*0.5*0.5;
																	local P3 = 0.5*Gravity*T1*T1 + V0*T1 + X0;
																	local P2 = P3 - (Gravity*T1*T1 + V0*T1)/3;
																	local P1 = (C*Gravity*T1*T1 + 0.5*V0*T1 + X0 - C*(X0+P3))/(3*C) - P2;
																	-- the curve sizes
																	local Curve0 = (P1 - X0).magnitude;
																	local Curve1 = (P2 - P3).magnitude;
																	-- build the world CFrames for the attachments
																	local B = (X0 - P3).unit;
																	local R1 = (P1 - X0).unit;
																	local U1 = R1:Cross(B).unit;
																	local R2 = (P2 - P3).unit;
																	local U2 = R2:Cross(B).unit;
																	B = U1:Cross(R1).unit;
																	local CF1 = CFrame_New(
																		X0.x, X0.y, X0.z,
																		R1.x, U1.x, B.x,
																		R1.y, U1.y, B.y,
																		R1.z, U1.z, B.z
																	local CF2 = CFrame_New(
																		P3.x, P3.y, P3.z,
																		R2.x, U2.x, B.x,
																		R2.y, U2.y, B.y,
																		R2.z, U2.z, B.z
																	return Curve0, -Curve1, CF1, CF2;
																	local X0 = RootPart.CFrame * Vector3_New(0, 2, -2)
																	local V0 = (ClosestTarget.HumanoidRootPart.Position - X0 - 0.5*Gravity*T*T)/T;
																	local Curve0, Curve1, CF1, CF2 = BeamProjectile_Func(V0, X0, T);
																	-- convert world space CFrames to be relative to the attachment parent
																	Attach0.CFrame = Attach0.Parent.CFrame:inverse() * CF1;
																	Attach1.CFrame = Attach1.Parent.CFrame:inverse() * CF2;	
																local X0 = RootPart.CFrame * Vector3_New(0, 2, -2)
																	-- calculate the v0 needed to reach mouse.Hit.p
																	local V0 = (ClosestTarget.HumanoidRootPart.Position - X0 - 0.5*Gravity*T*T)/T;
																	local Handle_Clone = Handle:Clone();
																	Handle_Clone.Parent = workspace;
																	-- have the ball travel that path
																	local NT = 0;
																	while (NT < T*2) do
																		Handle_Clone.CFrame = CFrame_New(0.5*Gravity*NT*NT + V0*NT + X0);
																		NT = NT + Heartbeat:Wait();

I think it’s because you are moving the projectile server-sided, resulting into this problem.
The gravity is pushing the projectile down (on client side). I think this could be solved by anchoring the projectile, but I could be also completly wrong. Try it out if it isn’t anchored yet.

you see I cant anchor my projectile due to it needing to move through the air

You can anchor it if you aren’t using things like BodyVelocity or Velocity. From your code I think you are changing it’s CFrame.

I am currently using velocity to get the lobbing effect

I’m not sure if this could help, but try to do:


This will set Network owner to server, because if you didn’t do that, the Network owner is a player. But I can be wrong once again.

I tried this and same thing occurs


You have to set it to nil, as I said :slight_smile:

Thanks, man I didn’t know you could set it nil :smile:
It ended up working

1 Like

Also, just a question does :SetNetworkOwner(nil) make the server have full control over the projectile

Yes, I think it does. You can read this article about :SetNetworkOwner()

1 Like