How Can I Create a Flying Command?

Hello! I’m currently working with the cmdr admin panel, and have attempted to create a flying command. I can’t find anything online that works, so I’ve taken to the forums for some help.


Here is the image of the server side script, player being the player that sent out the command. But I don’t know how to make the player actually fly. All help is appreciated, Thanks!

4 Likes

Greetings Ockloe!

I recommend watching some tutorials on youtube, but it is curcial to understand if your character is R6 or R15 as it would be a different process for both. Since it is a command, you could do something like:

local flying = false

game.Players.PlayerAdded:Connect(function(player)
    player.Chatted:Connect(function(message)
       local split = message.split(" ")
       local target = split[2]

     -- then find the target in players using your logic
  
       if target then
           local targetHumanoid = game.Workspace:WaitForChild(target).Humanoid

           humanoid:ChangeState(Enum.HumanoidStateType.Physics)
           humanoid:SetStateEnabled(Enum.HumanoidStateType.Flying, not flying)
           flying = not flying
       end
   end)
end)

Keep in mind this is for R6 only as I assume that is what you are trying to do, and after all this is only an example so feel free to change m logic!