I’m making a fly script for a drone, however it doesn’t work, and for whatever reason, on both the LinearVelocity and AngularVelocity the .Active
property isn’t true. Any help would be appreciated!
local Attachment = Middle.Attachment
local LinearVelocity = Instance.new("LinearVelocity", Attachment)
LinearVelocity.MaxForce = 400000
LinearVelocity.Attachment0 = Attachment
local AngularVelocity = Instance.new("AngularVelocity", Attachment)
AngularVelocity.RelativeTo = 0
AngularVelocity.MaxTorque = 400000
AngularVelocity.Attachment0 = Attachment
UserInputService.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.W and Controlling == true then
LinearVelocity.VectorVelocity = Camera.CFrame.LookVector * Speed
AngularVelocity.AngularVelocity = Vector3.new(AngularVelocity.AngularVelocity.X, 5, AngularVelocity.AngularVelocity.Z)
elseif Input.KeyCode == Enum.KeyCode.S and Controlling == true then
LinearVelocity.VectorVelocity = Camera.CFrame.LookVector * -Speed
AngularVelocity.AngularVelocity = Vector3.new(AngularVelocity.AngularVelocity.X, -5, AngularVelocity.AngularVelocity.Z)
elseif Input.KeyCode == Enum.KeyCode.A and Controlling == true then
AngularVelocity.AngularVelocity = Vector3.new(5, AngularVelocity.AngularVelocity.Y, AngularVelocity.AngularVelocity.Z)
elseif Input.KeyCode == Enum.KeyCode.D and Controlling == true then
AngularVelocity.AngularVelocity = Vector3.new(5, AngularVelocity.AngularVelocity.Y, AngularVelocity.AngularVelocity.Z)
end
end)
UserInputService.InputEnded:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.W and Controlling == true then
LinearVelocity.VectorVelocity = Vector3.new(0, 0, 0)
AngularVelocity.AngularVelocity = Vector3.new(AngularVelocity.AngularVelocity.X, 0, AngularVelocity.AngularVelocity.Z)
elseif Input.KeyCode == Enum.KeyCode.S and Controlling == true then
LinearVelocity.VectorVelocity = Vector3.new(0, 0, 0)
AngularVelocity.AngularVelocity = Vector3.new(AngularVelocity.AngularVelocity.X, 0, AngularVelocity.AngularVelocity.Z)
elseif Input.KeyCode == Enum.KeyCode.A and Controlling == true then
AngularVelocity.AngularVelocity = Vector3.new(0, AngularVelocity.AngularVelocity.Y, AngularVelocity.AngularVelocity.Z)
elseif Input.KeyCode == Enum.KeyCode.D and Controlling == true then
AngularVelocity.AngularVelocity = Vector3.new(0, AngularVelocity.AngularVelocity.Y, AngularVelocity.AngularVelocity.Z)
end
end)