Hello. I have this code:
local mouse = game.Players.LocalPlayer:GetMouse() mouse.Button1Down:Connect(function() local Bullet = Instance.new("Part") Bullet.Parent = game.Workspace Bullet.CanCollide = false Bullet.CFrame = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame * CFrame.Angles(0,math.rad(90),0) local Direction = (mouse.Hit.Position - game.Players.LocalPlayer.Character.HumanoidRootPart.Position).Unit Bullet.AssemblyLinearVelocity = Direction*100 end)
The line I am intersted in is:
local Direction = (mouse.Hit.Position - game.Players.LocalPlayer.Character.HumanoidRootPart.Position).Unit
That line and this give the same result:
local Direction = (mouse.Hit.Position).Unit
I don't understand why we need to use the first one? Can anyone explain the math?