Rocket launcher script buggy?

Hi everyone, so I have this simple rocket launcher script and it’s running a few issues.
When I try this rocket out against a player, they don’t instantly die when they come in contact with it, it takes a few hits and proper angles to aim the rocket and by chance when it hits them, their humanoid joints get broken and they die.

Also, if I hit the rocket launcher near myself or on the floor, I die (which is logical) but how can I make it so that the explosion does not kill the player who his holding the tool (me) and only kill anyone else who comes in contact with the ball?

Overall I want to make it so that as soon as any player character is touched by the rocket ball, they instantly die and their joints break, except the player that’s holding the rocket launcher tool.

--LOCALSCRIPT
local shootrocket = game.ReplicatedStorage.shootrocket.shootrocket
local tool = script.Parent
local value = 0
script.Parent.Activated:Connect(function()
	if value == 0 then

		local pos = script.Parent.Parent.Humanoid.TargetPoint
		local LookAt = (pos - script.Parent.Parent.Head.Position).Unit
		shootrocket:FireServer(LookAt, tool)
		--value += 1
	end
end)
--SERVERSCRIPT
game.ReplicatedStorage.shootrocket.shootrocket.OnServerEvent:Connect(function(player, LookAt, tool)
	local missile = Instance.new("Part")
	missile.Parent = game.Workspace
	missile.Shape = Enum.PartType.Ball
	missile.Color = Color3.fromRGB(255, 0, 0)
	missile.Position = tool.Handle.Position
	missile.Velocity = LookAt*100
	missile.Size = Vector3.new(1,1,1)
	missile.Transparency = 0.3
	local fly = Instance.new("BodyVelocity", missile)
	fly.MaxForce = Vector3.new(0,missile:GetMass()*196.2,0)
	game.Debris:AddItem(missile,10)
	wait()
	missile.Touched:Connect(function(hit)
		local e = Instance.new("Explosion")
		e.Position = missile.Position
		game.Workspace.sounds.RocketExplosion:Play()
                e.Parent = game.Workspace
		missile:remove()
	end)
end)
1 Like

Mistake: Humanoid would be in hit.Parent not in hit

Also you should check your error logs, they really can tell you what mistakes are making

On a side note after Instance.new you should set Parent last not first for performance reasons

Oh my mistake, ignore the if statement that shouldve been removed.