How to fix the rocket launcher ammo script

I’m trying to make a rocket launcher, I got everything working except for the ammo. Yeah the ammo moves and goes to the mouse.hit.p and stuff but the one problem is, the ammo dosent explode when it touches parts, only players
Tried using .Touched event but only detects players, I also want it to fire when it touches parts

I’m not asking for full codes but I want to know how to make it like should I use magnitude?

Code:

local part1 = workspace.Part1
local part2 = workspace.Part2
local pos = CFrame.new(part1.Position, part2.Position)
part1.CFrame = pos
local tweeninfo = TweenInfo.new(8)
local animation = game:GetService("TweenService"):Create(script.Parent,tweeninfo,{Position=script.Parent.pos.Value})
animation:Play()
script.Parent.Touched:Connect(function(part)
local boom = Instance.new("Explosion")
boom.Position = script.Parent.Position
boom.Visible = true
boom.Parent = game.Workspace
script.Parent:Destroy()
end)

.Touched detects parts as well, make sure the function connected to the .Touched event isn’t excluding parts which don’t belong to the characters of players.

First of all, show the script. We can’t help you without it.

Okay, I will send the script later since I can’t rn. Srry for that long response

I made sure it dosent exclude, it still only detects players, I’ll send the script later so you can fix the issue

They likely are already enabled but double check the “CanTouch” property of the parts as well.

Double-checked, it’s true. Not false

One question, does tweenservice affect .Touched?

As far as I’m aware, it doesn’t. Maybe it is an issue of not detecting touch because the part doesn’t touch other parts due to wanky hitboxes? Probably not the issue though. You could try making a larger hitbox that doesn’t collide (assuming the bullet part has CanCollide on).

The issue is probably script-related. Maybe you accidentally excluded the touching of other parts (by only running the script if the person is has a humanoid). Try putting a print statement at the very beginning of the function (right after the function declaration) and print the part touched. If it prints normal parts as well, then it is definitely a script-related issue. Also, it is quite difficult for us to help you without the script, so I suggest you post that too. You don’t need the whole script, just the touch function.

I think the problem is that when using a touched event one part has to be un-anchored. Every part in a character is un-anchored so, it’s either your rocket launcher is anchored or the part you want to hit is anchored.

More info is here.

so, how come the roblox’s rocket launcher works even if it hit an anchored object (and the ammo is anchored too)

okay, ive given the code, read edited post/

I’m pretty sure it does. Change it to body velocity. Not tween service

Hmm I’ll try that 30 ch arsssss

just one question
it works and everything and it detects hitted parts but bodyvelocity dosent go to the part
no luck

local pos = CFrame.new(script.Parent.pos.Value,script.Parent.Position)
script.Parent.CFrame = pos
script.Parent.BodyVelocity.Velocity = CFrame.new(script.Parent.Position, script.Parent.pos.Value).LookVector * 10

script.Parent.Touched:Connect(function(part)
	local boom = Instance.new("Explosion")
	boom.Position = script.Parent.Position
	boom.Visible = true
	--TESTING
	local redpart = Instance.new("Part",game.Workspace)
	redpart.Color = Color3.new(1, 0, 0.0156863)
	redpart.Anchored = true
	redpart.Position = script.Parent.Position
	print("Touched!")
	boom.Parent = game.Workspace
	script.Parent:Destroy()	
end)

image

You didn’t parent it to anything. Thats why.

wdym?
if you meant the bodyvelocity isnt parented heres proof:
image

Show me the velocity of the BodyVelocity. If it’s low then it won’t move.

its anyways gonna be changed by the script

script.Parent.BodyVelocity.Velocity = CFrame.new(script.Parent.Position, script.Parent.pos.Value).LookVector * 10

Can you share a studio file with the gun? Like a new one with only the gun? It’s really hard to help with how vague you’re being.