How to make a drone system?


So i’ve been wondering how I should make a drone. Not really for building a drone but scripting a drone.
Now I have no idea where to start scripting and how to do it.

So what do I need to make it fly up/down etc? Do I need to use ModuleScript for some things or is that not necessary and how do I use for example the ‘E’ key and what should I use to make it go up/down etc.

All tips would be appreciated!

1 Like

Make a part that will move OR
Just a position value

You can detect key press by invoking a function.

Hmmm, never tried this but I think that you can add BodyForces when it is moving for a smooth movement. Aside from that, is pretty much just handling input from player.

1 Like

And if a certain key is pressed you can move the cam.

Like this?:

local inputService = game:GetService("UserInputService")

inputService.InputBegan:Connect(function(input, gameProcessedEvent)
	if input.UserInputType == Enum.UserInputType.Keyboard then
		if input.KeyCode == Enum.KeyCode.E then
			--code so the drone will go up

yes exactly!
maybe now add a value that holds the drone state.
input e began: dronestate.Value = up
input e ended: dronestate.Value = notmoving

if Value= up then
start moving up

if Value= notmoving then
stop moving


From there you can add .inputChanged which will let you move it in 2 directions depending, I remember doing something like this a time ago (not for a drone though).

i did something like this

while wait() do
local ekeypressed = function:InvokeClient(plr, Enum.KeyCode.E)
if ekeypressed then
position +=, studs, 0)

Using RemoteFunction:InvokeClient may be problematic. The DevHub page mentions that it will error if the client disconnects or leaves while it’s being invoked.

And invoking the client tens of times per second will cause unnecessary network traffic. You could just have the client fire a remote event whenever there’s a change in drone movement related input.

I know this but i used a pcall.
Not very good

I just made a script that is using BodyVelocity and now the drone can go up and down! Anyways thanks for your help!

1 Like