Welding a mesh into a part make it not CFrame properly

I am makign a simple projectile using a part and BodyVelocity. When I set the CFrame of the part to the players HumanoidRootPart CFrame and parent it to workspace, everything works fine! When i try to weld a mesh into that exact same part, it will not Cframe to the players HRP, instead when I parent it to workspace, it keeps its previous Position.

here is what it looks like in explorer, the Parts are identical except for one has a mesh welded into it.

all parts involved are un-anchored and cancollide OFF. I checked the weld and redid it several times.

here is the code:

local bullet = ReplicatedStorage.EffectParts.Abilities.BulletLaunch.Bullet:Clone()
    bullet.BodyVelocity.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
    bullet.BodyVelocity.P = 300
    bullet.BodyVelocity.Velocity = rootPart.CFrame.LookVector * 300
    bullet.CFrame = initPlayer.Character.HumanoidRootPart.CFrame
    bullet.Parent = Workspace.RenderedEffects

I have done this before, but for the life of me I feel like welds are so unpredictable. Anyone now what up?

1 Like

Use a normal weld
WeldConstraints do the offsetting for you
Normal welds will not offset for you and if their .C0 property isn’t changed Part1 will be placed at Part0’s CFrame

2 Likes

Parts welded to each other with WeldConstraints are supposed to always move together when CFraming them. Welds are supposed to be deprecated, i use them from time to time but this is not the way it supposed to be.

EDIT: I tried it anyway and the results are the same with WeldConstraints or regular Welds

From the looks of it you’re cloning the bullet that doesn’t have a meshpart welded to it

Wouldn’t .Bullet need to be .Bullet_Mesh?
or am I missing something cause thats definitely possible

thats just sample code, swap out the name to test each one.

Bullet works perfectly.
Bullet_Mesh is the problem child.

Maybe I’m just dumb(or blind) but after re-reading your post 10+ times
The issue is when you set the CFrame of the bullet to the characters HRP the mesh doesn’t move with the bullet right?

yes thats right. theres a small part thats a container because its easier to Cframe than the mesh, which has a front face on the side. So i just weld the mesh inside the part. I have done this a dozen times before. But this wont be the first time I have to report bugs with WeldConstraints.

Yeah you’re probably going to have to make a bug report but before you do that try checking the properties of everything once more the weld especially check if its active(during runtime) or disabled and such
But heres a list of everything I tried

  1. Maybe it was the fact it was being cloned from ReplicatedStorage? Nope tried it from ReplicatedStoarge, ReplicatedFirst, ServerStorage, ServerScriptService, Workspace and it even worked when i cloned it from my players PlayerGui
  2. Maybe you were setting the CFrame of the wrong part? Nope setting the CFrame of Part1 or 0 will move the other
  3. Maybe BodyVelocity was doing some weird stuff? Nope tried with, LineForce, VectorForce, BodyThrust, BodyForce, BodyVelocity and RocketPropulsion

Here is the code I was using if you might need it

--Things were changed depending on what BodyMover/Constraint I was using
local rootPart = workspace.Part
local initPlayer = workspace.Player
--These are random parts that "pretend" to be the CFrame of the rootpart and such I also tested it with my character and it worked fine

while true do -- Loop so I can edit the bullet in real time instead of running each time I make a change
	local bullet = game.ReplicatedStorage.Bullet:Clone()
	bullet.BodyVelocity.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
	bullet.BodyVelocity.P = 300
	bullet.BodyVelocity.Velocity = rootPart.CFrame.LookVector * 300
	bullet.CFrame = initPlayer.CFrame
	bullet.Parent = workspace
	game:GetService("Debris"):AddItem(bullet, 4) -- To not fill up workspace with random stuff
	wait(1)
end
1 Like

this worked for you? Thats exactly what I am doing. I have doubel and triple checkd al the properties of everything.

I can see the bullet flying over my head when i fire it, its starting its flight from its original position instead of the one i am CFraming it to before it fires.

Yeah each of those had the both parts CFrame properly and fly over my head in the proper position using that code