So I have a rocket launcher tool here, and it works. But however, the missle explodes and kills whoever is holding it. For instance, your holding the rocket launcher, you activate the tool, and the missle touches you and you get killed. I want it to not kill whoever is holding it and only explodes whenever they hit a part.
Here is how it looks like.
local tool = script.Parent
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local handle = tool.Handle
local db = false
local hum = tool.Parent:FindFirstChild("Humanoid")
if hum and db == false then
db = true
local mousePos = mouse.Hit.Position
db = false
local handle = script.Parent.Handle
-- start to make the missle
local missle = Instance.new("Part")
missle.CFrame = CFrame.new(handle.Position,pos)
missle.Size = Vector3.new(1,1,2)
missle.BrickColor = BrickColor.new("Really red")
local bodyVelocity = Instance.new("BodyVelocity")
bodyVelocity.Parent = missle
bodyVelocity.Velocity = (pos - handle.Position).Unit * 25
bodyVelocity.MaxForce = Vector3.new("inf","inf","inf")
local pointLight = Instance.new("PointLight")
pointLight.Brightness = 100000
pointLight.Parent = missle
missle.Parent = workspace
if hit ~= handle and not script.Parent.Parent:FindFirstChild(hit.Name) and hit.Parent ~= script.Parent.Parent then
local explosion = Instance.new("Explosion")
explosion.Parent = workspace
explosion.Position = missle.Position
To confirm, what is the parent of the
Rocket Launcher tool?
Oh, it is a tool that shoots out the bullet. I don’t know what you meant by that.
What place is the Rocket Launcher tool in? e.g Workspace/ServerStorage
It is in StarterPlayer. I put it there.
The issue is that you are adding a new explosion. An explosion effect will kill you. Find more information here. Explosion | Documentation - Roblox Creator Hub
Yeah I know, but I want the explosion effect only explodes when it hits other parts, and not whoever is holding it.
If possible, could you provide a GIF of what’s happening when you test the tool?
Oh well, it’s broken. I can’t shoot anymore. Can you help me test it?
I don’t know if this is what your looking for
but i hope it helps
local Explotion = Instance.new("Explosion")
Explotion.BlastRadius = 20
Explotion.DestroyJointRadiusPercent = 0
Explotion.Position = Character.PrimaryPart.Position
Explotion.Parent = Character
if part.Parent:FindFirstChild("Humanoid") then
if part.Parent ~= Character then
I changed the DestroyJointRadiusPercent so that the players would not get killed by the explotion
then i used the Hit event of the explotion to check if the explotion hit the player’s character or another player’s character
I hope it helps
This is not what I wanted. I said I want it to explode when it touches a part, not only explodes when it hits a humanoid.
If you paste my script in to yours, then the explotion will still happend.
just the difference is that it will not kill the player that fired the rocket
You may want to set the DestroyJointRadiusPercent of the explosion to 0