Hi, I'm trying to create a gun that fires cylinder-shaped projectiles. I want the projectiles to be rotated in a way that the ends are facing downwards and not side to side.
player = game.Players.LocalPlayer
weapon = script.Parent
mouse = player:GetMouse()
function shoot()
local laser = Instance.new("Part", workspace)
laser.Shape = "Cylinder"
laser.CanCollide = false
laser.Size = Vector3.new()
laser.BottomSurface = "Smooth"
laser.BackSurface = "Smooth"
laser.FrontSurface = "Smooth"
laser.LeftSurface = "Smooth"
laser.RightSurface = "Smooth"
laser.TopSurface = "Smooth"
laser.Rotation = Vector3.new( 0, 0, 90)
laser.CFrame = weapon.Handle.CFrame
laser.CFrame = CFrame.new(laser.Position,mouse.Hit.p)
v = Instance.new("BodyVelocity", laser)
v.Velocity = laser.CFrame.lookVector *90
v.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
end
weapon.Activated:connect(shoot)
Even though I set the projectile's rotation, the rotation is still way off when it's fired.

1 comment
CFrame is Position and rotation. Try moving line 15 below line 17.