I have an issue that the bullet doesnt do a staight line.
I think the video makes clear what the problem is
Also a graphic
my code:
pt = workspace.Gun:WaitForChild("DrehPunkt")
pt.Parent = game.Workspace.CurrentCamera
local plr = game.Players.LocalPlayer
Mouse = plr:GetMouse()
local prev_mousehit
Mouse.Move:connect(function()
if Mouse.Hit.p ~= prev_mousehit then
pt.CFrame = CFrame.new(pt.Position, Vector3.new(Mouse.Hit.p.X,pt.Position.Y,Mouse.Hit.p.Z))
prev_mousehit = Mouse.Hit.p
end
end)
local Bullet = workspace.Gun.Bullet
game:GetService("UserInputService").InputBegan:connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
print("LeftClick")
local clonedBullet = Bullet:Clone()
clonedBullet.Name = "cBullet"
clonedBullet.Parent = Bullet.Parent.ClonedBullet
clonedBullet.Position = Bullet.Position
clonedBullet.Orientation = Bullet.Orientation
clonedBullet:WaitForChild("BodyForce").Force = Vector3.new(0,20,0)
clonedBullet:WaitForChild("BodyVelocity").Velocity = clonedBullet.CFrame.lookVector * 500
end
end)