Is this the right way to use it?
function onKeyPress(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.F then
local mouse = game.Players.LocalPlayer:GetMouse()
local gun = workspace.Turret.Gun2
local gunPos= gun.Position
local part = Instance.new("Part",workspace)
part.Size = Vector3.new(1,1,2)
part.Material = "SmoothPlastic"
part.Position = gunPos
part.CanCollide = false
--Workspace
-- Part1
-- Vector3Value
--I am using a Vector3 Value named "Vector3Value" (the object type) to not interfere in the current Velocity
local Force = 1
local Gravity = 1 --The Current Gravity of the Bullet 0-1 |0|None |.5|medium |1|Full
local PreVelocity = game.Workspace.Vector3Value
PreVelocity.Value = Vector3.new(part.CFrame.LookVector * Force)
part.Velocity = Vector3.new(PreVelocity.Value.X,part.Velocity.Y*Gravity,PreVelocity.Value.Z)
part.Touched:connect(function(hit)
if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 3000
end
end)
end
end
game:GetService("UserInputService").InputBegan:connect(onKeyPress)

1 comment
btw the body force is in there for example