-- Decompiled with the Synapse X Luau decompiler.


local v1 = {};
local l__HDAdminMain__1 = _G.HDAdminMain;
local function u2(p1, p2)
	for v2, v3 in pairs(p1:GetDescendants()) do
		if v3:IsA("BasePart") then
			l__HDAdminMain__1.physicsService:SetPartCollisionGroup(v3, p2);
		end;
	end;
end;
function v1.Fly(p3, p4, p5)
	local v4 = "PlatformStand";
	if p4 == "fly2" then
		v4 = "Sit";
	end;
	local v5 = l__HDAdminMain__1:GetModule("cf"):GetHRP();
	local v6 = l__HDAdminMain__1:GetModule("cf"):GetHumanoid();
	if v5 and v6 then
		local v7 = Instance.new("BodyPosition");
		v7.MaxForce = Vector3.new(math.huge, math.huge, math.huge);
		v7.Position = v5.Position + Vector3.new(0, 4, 0);
		v7.Name = "HDAdminFlyForce";
		v7.Parent = v5;
		local v8 = Instance.new("BodyGyro");
		v8.D = 50;
		v8.MaxTorque = Vector3.new(math.huge, math.huge, math.huge);
		if p5 then
			v8.P = 2000;
		else
			v8.P = 200;
		end;
		v8.Name = "HDAdminFlyGyro";
		v8.CFrame = v5.CFrame;
		v8.Parent = v5;
		local v9 = 0;
		if p5 then
			u2(workspace, "Group1");
			u2(l__HDAdminMain__1.player.Character, "Group2");
		end;
		local v10 = tick();
		local v11 = v5.Position;
		while true do
			local v12 = l__HDAdminMain__1.commandSpeeds[p4];
			local v13, v14 = l__HDAdminMain__1:GetModule("cf"):GetNextMovement(tick() - v10, v12 * 10);
			local l__Position__15 = v5.Position;
			local v16 = CFrame.new(l__Position__15, l__Position__15 + (l__HDAdminMain__1.camera.Focus.p - l__HDAdminMain__1.camera.CFrame.p).unit) * v13;
			local v17 = 750 + v12 * 0.2;
			if p5 then
				v17 = v17 / 2;
			end;
			if v13.p ~= Vector3.new() then
				local v18 = 0;
				v7.D = v17;
				local v19 = 0 + 1;
				v7.Position = v16.p;
			else
				v18 = v9 + 1;
				v19 = 1;
				if (v5.Position - v11).magnitude > 6 and v18 >= 4 then
					v7.Position = v5.Position;
				end;
			end;
			if math.abs(v19) > 25 then
				v19 = 25;
			end;
			if v7.D == v17 then
				local v20 = 0 * v14.X * -0.5;
				if p5 then
					local v21 = 0;
				else
					v21 = 0 * v14.Z;
				end;
				v8.CFrame = v16 * CFrame.Angles(math.rad(v21), 0, 0);
			end;
			v10 = tick();
			v11 = v5.Position;
			v6[v4] = true;
			wait();
			if not l__HDAdminMain__1.commandsActive[p4] then
				break;
			end;
			if not v6 then
				break;
			end;
			if not v5 then
				break;
			end;		
		end;
		v7:Destroy();
		v8:Destroy();
		if v6 then
			v6[v4] = false;
		end;
		if p5 then
			u2(workspace, "Group3");
		end;
	end;
	l__HDAdminMain__1.commandsActive[p4] = nil;
end;
return v1;
