local z = gun.Barrel.Position.Z
shell.Velocity = Vector3.new(50, 150, z)

Keep in mind that isn't the full script, but the prominent issue.

I want to obtain the Z coordinate from the position, and then whatever the value is, its transferred to the vector3 for velocity. However, it doesn't work and the function for firing only fires straight. There is clearly an issue but I can't seem to find what it exactly is. I believe what the issue is probably that the Z value isn't recognized in the vector3, but if so there should be a warning given in output, which there isn't. If possible, is there anyway I can also make the script update the Z value if the Z coordinate changes?

3 comments

0

hmmm, this should work. wdym by only firing straight?

0

CFrame, magnitude, etc xd

0

@starmaq nope, when the model is angled and the firing function starts, it keeps just firing straight and not at an angle.