Help with gun script

Hello! I’m trying to make a gun, everything is fine, the only problem is that the bullet does not come out as it should, how can I solve it?
Example Clip


Code

function Activated(Plr,target)
	local Position = Handle.Position 
	local Bullet = Instance.new("Part")
	Bullet.Anchored = false
	Bullet.CanCollide = false
	Bullet.Material = Enum.Material.Neon
	Bullet.Size = Vector3.new(1.57, 0.213, 0.21)
	Bullet.Color = Color3.fromRGB(255, 255, 0)
	Bullet.CFrame = CFrame.new(Position,target) 
	Bullet.Parent = workspace
	local BodyVelocity = Instance.new("BodyVelocity")
	BodyVelocity.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
	BodyVelocity.velocity = Bullet.CFrame.LookVector * 100
	BodyVelocity.Parent = Bullet
end

i dont know its in the x axis im not sure how to do it bcz im new scripter so try to change the x axis to 90 degrees or -90 and it should work

change it after all of the code so it will work
i dont know more than that

u resized it wrong the size should be

Vector3.new(0.21, 0.213, 1.57)
1 Like

So it was just reversing the axes?

Yea the CFrame.new works with the front surfce CFrame.new(Pos,PosToLookAt)

the Cframe uses the part LookVector

The LookVector can be found by just adding a decal then just look for the high lighted part Then make sure use Z when u using CFrame for positioning parts/models on their back or front

1 Like

It’s actually CFrame.fromMatrix(pos, X, Y Z)

my bad u are right i forgot about this since i dont use cframe this days

1 Like