Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why does my missile slightly bounce off of target before exploding?

I use BodyVelocity to move my projectile towards the target, and whenever the server is in slight latency, the missiles I shoot tend to bounce off of the target and then explode, causing problems like the target not receiving the full impact of the blow or the missile bouncing off and going in a completely different direction than expected. Here is my collision script, and if any other method works, then tell me and give me an example! Thanks!

	rocket.Touched:connect(function(hitpart)
		rocket.Anchored = true
		if hitpart.Parent ~= Tool then
				rocket.Anchored = true
				rocket.Transparency = 1
				local explosion = Instance.new("Sound",rocket)
				explosion.SoundId = "rbxassetid://187137543"
				explosion.Volume = 20
				explosion.MaxDistance = 10000
				explosion:Play()
				local plosion = Instance.new("Explosion",workspace)
				plosion.Position = rocket.Position
				plosion.BlastPressure = 500
				plosion.DestroyJointRadiusPercent = 0
				game.Debris:AddItem(rocket,1)
				
				plosion.Hit:connect(function(hit)
				if hit.Name == "BuildBrick"and (hit.Position - workspace.BlueSafeZone.Position).magnitude > 135 then
					hit:Destroy()
					plosion.BlastRadius = 10

					game.Debris:AddItem(rocket,.1)
					end)

1 comment

0

Have you tried the RocketPropulsion object with the TargetReached event?

1 answer

Lag!

Good old lag. Everyone hates lag. The deal is, not everything decides to happen at the same time. Depending on where and how you connect your events, clients may continue their own version of the distributed simulation (This is where the bounce happens) before the replication of the explosion happens.

You can fix this by allowing clients to pre-empt the server's actions, or just ignoring it. Your choice. Good games need good programmers; be that person.

This discussion is preserved as it was. New answers, comments, and votes are closed.