this is the script

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 TARGET_RADIUS = 5
	local MAX_SPEED = 200
	local MAX_TORQUE = Vector3.new(4e6, 4e6, 0)
	local MAX_THRUST = 1000000
	local THRUST_P = 1000000
	local THRUST_D = 1000000
    local part = Instance.new("Part",workspace)
	local direction = ((((mouse.Hit.p - part.Position))).unit)
    part.Size = Vector3.new(1,1,1)
    part.Material = "SmoothPlastic"
    part.Position = gunPos
    part.Velocity = Vector3.new(0,0,150)
	local rocketPropulsion = Instance.new('RocketPropulsion')
		rocketPropulsion.Parent = part
	    rocketPropulsion.CartoonFactor = 0
	    rocketPropulsion.TargetRadius = TARGET_RADIUS
	    rocketPropulsion.MaxSpeed = MAX_SPEED
	    rocketPropulsion.MaxTorque = MAX_TORQUE
     	rocketPropulsion.MaxThrust = MAX_THRUST
    	rocketPropulsion.ThrustP = THRUST_P
	    rocketPropulsion.ThrustD = THRUST_D
		rocketPropulsion.TargetOffset = part.Position + (direction * 100000000)
		rocketPropulsion:Fire()
    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)


2 comments

0

anyone?

0

Try using the instance "BodyVelocity" using math.huge as each x,y,z in the MaxForce. In my opinion I feel like BodyVelocity is just more simple.