How to fix server side and client side issues

I have been stuck on a problem like this for a while now, and I can’t seem to fix it.
I have a fast projectile that is supposed to explode on contact, and it works fine on the server but it explodes before contact on the client.
I have messed with networkownership for a while also, and it doesn’t seem to make a difference.

I have also recently been trying to use the new shapecast feature over the touched event. It doesn’t seem to make a difference.

Important Code (I don’t think the code really matters with a problem like this):

	maxarc = coroutine.create(function()
		while task.wait() do
			local direction = clone.CFrame.UpVector * raycastLength
			local result = workspace:Spherecast(clone.Position, raycastRadius, direction, raycastParams)
			if result and result.Instance then
				local exaudio = game.SoundService.MortarAudio["Explosion [Quick]"]:Clone()

				local exgfx = game.ServerStorage.BulletExplosionParticles:GetDescendants()

				local PO = clone.ParticleOrigin

				for i, v in pairs(exgfx) do
					local pclone = v:Clone()
					pclone.Parent = PO
					pclone.Enabled = true


				exaudio.Parent = PO

				clone.Transparency = 1
				clone.CanTouch = false
				clone.Anchored = true

				for i, v in pairs(PO:GetDescendants()) do
					if v.Name == "ParticleEmitter" then
						v.Enabled = false


Client Side Video:

Server Side Video:

Please help me I think I’m becoming Insane

Not sure, it’s probably just a little delay. I don’t really think you can do much about that. Only good thing is that it probably won’t be TOO noticeable.

It hovers 10 more studs in the air than intended, and I don’t see many games suffering from explosions 10 studs in the air.

Maybe increase its velocity on the client then?

(I’m not entirely sure what you’re using to move it whether it be ApplyImpulse or whatever else).

I’m using apply impulse, and I don’t think that higher velocity will effect the registry because I have tried this before.

Assuming “clone” is a part, you could use the .Touched event (assuming it is a part).

Clone is a part and I have used the touched event. It had the same problem so I moved to shapecast which still has the problem.

Hm. Well that’s all I can really think of. Sorry I couldn’t fix the problem. Good luck trying to fix it though. Best wishes.

Found the issue.
Since it was a server script, it was running a little too fast for the client. The bullet hit the part on the server before the bullet hit the part on the client thus making it explode in the air. All I had to do was just make it a client script. I will probably use remote function and events to make it better but for now, it works :).

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