What I have made so far (I've done the camera stuff so you are in the Drone's POV):
local tool = script.Parent
local Camera = workspace.CurrentCamera
local Plr = game.Players.LocalPlayer
_G.onDrone = false
local ContextActionService = game:GetService("ContextActionService")
local FREEZE_ACTION = "freezeMovement"
tool.Equipped:Connect(function()
print("On Drone.")
_G.onDrone = true
end)
tool.Unequipped:Connect(function()
print("Not on Drone.")
_G.onDrone = false
end)
while true do
wait()
if _G.onDrone == false then
ContextActionService:UnbindAction(FREEZE_ACTION) -- This allows the player to move
Camera.CameraType = Enum.CameraType.Custom
Camera.CameraSubject = Plr.Character.Humanoid
elseif _G.onDrone == true then
ContextActionService:BindAction( -- This stops the player from moving while using the drone
FREEZE_ACTION,
function()
return Enum.ContextActionResult.Sink
end,
false,
unpack(Enum.PlayerActions:GetEnumItems())
)
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = script.Parent.Drone.CameraPart.CFrame
end
end
How could I make it so I can control the car?
