LookVector not multiplying with distance

Basically, the bullet from the gun stays on the bullet point, doesn’t go forward at all, i’ve tested the tweening for the bullets and it works with a correct Cframe, but this getting the cframe for the lookvector doesnt seem to be working.

local v3 = tool.BulletPoint.CFrame.LookVector * 100
local up = Vector3.new(0, 1, 0)
local cf = CFrame.fromMatrix(tool.BulletPoint.Position, v3, up)
ReplicatedStorage.Remotes.ShootWeapon:InvokeServer("GoldenMinigun", cf, selectedTool.Value)

local v3 = tool.BulletPoint.CFrame.LookVector
local up = Vector3.new(0, 1, 0)
local cf = CFrame.fromMatrix(tool.BulletPoint.Position, v3, up) * CFrame.new(0, 0, -100)
ReplicatedStorage.Remotes.ShootWeapon:InvokeServer("GoldenMinigun", cf, selectedTool.Value)
1 Like

fromMatrix(pos: Vector3, vX: Vector3, vY: Vector3, vZ: Vector3)
Returns a CFrame from a translation and the columns of a rotation matrix.
- CFrame | Roblox Creator Documentation

It expects 4 params, you gave it 3. Omitting the 4th means it doesn’t have a Z vector to work with, and presumably it just uses Vector3.zero in that case or some other “sensible default” (it should error, but that’s besides the point). If it uses Vector3.zero for the Z direction of the rotation matrix, that might explain why you don’t get any movement.

Did you mean to use CFrame.lookAt? CFrame | Roblox Creator Documentation

Thank you, I just multiplied by the x axis instead of z

No

It uses Cross vector of x and y for the z if there isn’t anything

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.